Browse code

bb#2341

aCaB authored on 2011/01/21 23:07:06
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Jan 21 15:05:13 CET 2011 (acab)
2
+-----------------------------------
3
+ * libclamav/disasm.c: sign extend immeds, displacers and reljumps (bb#2341)
4
+
1 5
 Thu Jan 20 15:34:00 CET 2011 (tk)
2 6
 ---------------------------------
3 7
  * shared/optparser: when size limit is disabled set it to 4GB (bb#2471)
... ...
@@ -1200,8 +1200,6 @@ static void spam_x86(struct DISASMED *s, char *hr) {
1200 1200
     case ACCESS_NOARG:
1201 1201
       break;
1202 1202
     case ACCESS_IMM:
1203
-      hr += sprintf(hr, "%s %lx", comma, (long)s->args[i].arg.q);
1204
-      break;
1205 1203
     case ACCESS_REL:
1206 1204
       if (s->args[i].arg.rq >=0)
1207 1205
 	hr += sprintf(hr, "%s %lx", comma, (long)s->args[i].arg.q);
... ...
@@ -1418,10 +1416,10 @@ static const uint8_t *disasm_x86(const uint8_t *command, unsigned int len, struc
1418 1418
 	  GETBYTE(b);
1419 1419
 	  s->args[0].arg.q+=(uint64_t)b<<(i*8);
1420 1420
 	}
1421
-	if (x86ops[table][s->table_op].dmethod==ADDR_RELJ) {
1421
+	/* if (x86ops[table][s->table_op].dmethod==ADDR_RELJ) { */
1422 1422
 	  s->args[0].arg.q<<=((8-sz)*8);
1423 1423
 	  s->args[0].arg.rq>>=((8-sz)*8);
1424
-	}
1424
+	/* } */
1425 1425
 	s->state = STATE_CHECKSTYPE;
1426 1426
 	continue;
1427 1427
       }
... ...
@@ -1627,6 +1625,8 @@ static const uint8_t *disasm_x86(const uint8_t *command, unsigned int len, struc
1627 1627
 	  GETBYTE(b);
1628 1628
 	  s->args[s->cur].arg.q+=b<<(i*8);
1629 1629
 	}
1630
+	  s->args[s->cur].arg.q<<=((8-sz)*8);
1631
+	  s->args[s->cur].arg.rq>>=((8-sz)*8);
1630 1632
 	s->state = STATE_FINALIZE;
1631 1633
 	continue;
1632 1634
       }