Browse code

Handle global gep parameter correctly (bb #1955).

Török Edvin authored on 2010/05/14 17:29:27
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri May 14 11:28:52 EEST 2010 (edwin)
2
+-------------------------------------
3
+ * libclamav/bytecode.c: handle global gep parameter correctly (bb #1955)
4
+
1 5
 Thu May 13 23:40:11 EEST 2010 (edwin)
2 6
 -------------------------------------
3 7
  * libclamav/c++/llvm: Update to LLVM 2.7 release.
... ...
@@ -1852,7 +1852,8 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
1852 1852
 		    MAPPTR(inst->u.unaryop);
1853 1853
 		    break;
1854 1854
 		case OP_BC_GEP1:
1855
-		    if (bcfunc->types[inst->u.binop[1]]&0x8000) {
1855
+		    if (inst->u.three[1]&0x80000000 ||
1856
+			bcfunc->types[inst->u.binop[1]]&0x8000) {
1856 1857
                       cli_errmsg("bytecode: gep1 of alloca is not allowed\n");
1857 1858
                       return CL_EBYTECODE;
1858 1859
                     }
... ...
@@ -1864,7 +1865,8 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
1864 1864
                     break;
1865 1865
 		case OP_BC_GEPZ:
1866 1866
 		    /*three[0] is the type*/
1867
-		    if (bcfunc->types[inst->u.three[1]]&0x8000)
1867
+		    if (inst->u.three[1]&0x80000000 ||
1868
+			bcfunc->types[inst->u.three[1]]&0x8000)
1868 1869
 			inst->interp_op = 5*(inst->interp_op/5);
1869 1870
 		    else
1870 1871
 			inst->interp_op = 5*(inst->interp_op/5)+3;