[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Török Edvin edwin at clamav.net
Sun Apr 4 01:03:58 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 479fa7135ce5e229ceefbb13885814850def18f0
Author: Török Edvin <edwin at clamav.net>
Date:   Wed Sep 2 17:44:18 2009 +0300

    Fix type checking.

diff --git a/libclamav/bytecode.c b/libclamav/bytecode.c
index ab1455b..77a8e63 100644
--- a/libclamav/bytecode.c
+++ b/libclamav/bytecode.c
@@ -502,7 +502,7 @@ static int parseTypes(struct cli_bc *bc, unsigned char *buffer)
 		break;
 	    case 2:
 	    case 3:
-		ty->kind = (t == 2) ? DStructType : DPackedStructType;
+		ty->kind = (t == 2) ? DPackedStructType : DStructType;
 		ty->size = ty->align = 0;/* TODO:calculate size/align of structs */
 		parseType(bc, ty, buffer, &offset, len, &ok);
 		if (!ok) {
@@ -554,7 +554,7 @@ static int parseTypes(struct cli_bc *bc, unsigned char *buffer)
 static int types_equal(const struct cli_bc *bc, uint16_t *apity2ty, uint16_t tid, uint16_t apitid)
 {
     unsigned i;
-    const struct cli_bc_type *ty = &bc->types[tid - 64];
+    const struct cli_bc_type *ty = &bc->types[tid - 65];
     const struct cli_bc_type *apity = &cli_apicall_types[apitid];
     /* If we've already verified type equality, return.
      * Since we need to check equality of recursive types, we assume types are
diff --git a/libclamav/c++/bytecode2llvm.cpp b/libclamav/c++/bytecode2llvm.cpp
index 749bcc2..afb5401 100644
--- a/libclamav/c++/bytecode2llvm.cpp
+++ b/libclamav/c++/bytecode2llvm.cpp
@@ -324,6 +324,11 @@ public:
 		++I;
 	    }
 	    for (unsigned i=func->numArgs;i<func->numValues;i++) {
+		if (!func->types[i]) {
+		    //instructions without return value, like store
+		    Values[i] = 0;
+		    continue;
+		}
 		Values[i] = Builder.CreateAlloca(mapType(func->types[i]));
 	    }
 	    numLocals = func->numLocals;
diff --git a/unit_tests/input/apicalls.cbc b/unit_tests/input/apicalls.cbc
index 20d4a88..551e0bc 100644
--- a/unit_tests/input/apicalls.cbc
+++ b/unit_tests/input/apicalls.cbc
@@ -1,5 +1,5 @@
-ClamBCaa`|`````|`agafp`clamcoincidencejb
-Tedebfdacb`bb`bb`b
+ClamBCaa`|`````|`afafp`clamcoincidencejb
+Tedacb`bb`bb`b
 Eabaaabbed|b`acflfifoebfcfaf`gifoedgefcgdgac``
 A`b`bLacb`baab`bFadaa
 Bb`b``bbabHonnkm``odHm``oonnkdaaaadab`b`Hhgfedcbadb`babnaaaDm``odDmjnmdTcab`babE

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list