]> Git Repo - qemu.git/commitdiff
Add more boundary checking to sse3/4 parsing
authorAndi Kleen <[email protected]>
Sat, 26 Jun 2010 22:06:11 +0000 (00:06 +0200)
committerAurelien Jarno <[email protected]>
Thu, 1 Jul 2010 23:53:37 +0000 (01:53 +0200)
ssse3 uses tables with only two entries per op, but it is indexed
with b1 which can contain variables upto 3. This happens when ssse3
or sse4 are used with REP* prefixes.

Add boundary checking for this case.

Signed-off-by: Andi Kleen <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
target-i386/translate.c

index 8cb5cf0b0a3e7efc53f5707d9db310cf2ae120cb..2fcc026165fe1dd16a4529b7413e6f811a17beb9 100644 (file)
@@ -3472,6 +3472,9 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
         case 0x171: /* shift xmm, im */
         case 0x172:
         case 0x173:
+            if (b1 >= 2) {
+               goto illegal_op;
+            }
             val = ldub_code(s->pc++);
             if (is_xmm) {
                 gen_op_movl_T0_im(val);
@@ -3699,6 +3702,9 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
             rm = modrm & 7;
             reg = ((modrm >> 3) & 7) | rex_r;
             mod = (modrm >> 6) & 3;
+            if (b1 >= 2) {
+                goto illegal_op;
+            }
 
             sse_op2 = sse_op_table6[b].op[b1];
             if (!sse_op2)
@@ -3798,6 +3804,9 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
             rm = modrm & 7;
             reg = ((modrm >> 3) & 7) | rex_r;
             mod = (modrm >> 6) & 3;
+            if (b1 >= 2) {
+                goto illegal_op;
+            }
 
             sse_op2 = sse_op_table7[b].op[b1];
             if (!sse_op2)
This page took 0.026355 seconds and 4 git commands to generate.