]> granicus.if.org Git - yasm/commitdiff
Fix NULL dereference for certain cases of REX used with jump instruction.
authorPeter Johnson <peter@tortall.net>
Mon, 10 Dec 2007 05:20:32 +0000 (05:20 -0000)
committerPeter Johnson <peter@tortall.net>
Mon, 10 Dec 2007 05:20:32 +0000 (05:20 -0000)
svn path=/trunk/yasm/; revision=2024

modules/arch/x86/tests/Makefile.inc
modules/arch/x86/tests/o64loop.asm [new file with mode: 0644]
modules/arch/x86/tests/o64loop.errwarn [new file with mode: 0644]
modules/arch/x86/tests/o64loop.hex [new file with mode: 0644]
modules/arch/x86/x86bc.c

index c90932464aa167368163fb81cc469c8716e7674f..9069d2c270d3531e893b93c35e975d5347f6a833 100644 (file)
@@ -104,6 +104,9 @@ EXTRA_DIST += modules/arch/x86/tests/nomem64.errwarn
 EXTRA_DIST += modules/arch/x86/tests/nomem64.hex
 EXTRA_DIST += modules/arch/x86/tests/o64.asm
 EXTRA_DIST += modules/arch/x86/tests/o64.hex
+EXTRA_DIST += modules/arch/x86/tests/o64loop.asm
+EXTRA_DIST += modules/arch/x86/tests/o64loop.errwarn
+EXTRA_DIST += modules/arch/x86/tests/o64loop.hex
 EXTRA_DIST += modules/arch/x86/tests/opersize.asm
 EXTRA_DIST += modules/arch/x86/tests/opersize.hex
 EXTRA_DIST += modules/arch/x86/tests/opsize-err.asm
diff --git a/modules/arch/x86/tests/o64loop.asm b/modules/arch/x86/tests/o64loop.asm
new file mode 100644 (file)
index 0000000..14f7951
--- /dev/null
@@ -0,0 +1,3 @@
+[bits 64]
+o64 loop next
+next:
diff --git a/modules/arch/x86/tests/o64loop.errwarn b/modules/arch/x86/tests/o64loop.errwarn
new file mode 100644 (file)
index 0000000..55f8201
--- /dev/null
@@ -0,0 +1 @@
+-:2: warning: ignoring REX prefix on jump
diff --git a/modules/arch/x86/tests/o64loop.hex b/modules/arch/x86/tests/o64loop.hex
new file mode 100644 (file)
index 0000000..55e2c21
--- /dev/null
@@ -0,0 +1,2 @@
+e2 
+00 
index f3717bf7a4e22c2c280d24cfb720c8bf2b3d0d18..dfcaa26c1630528b6e8057dc5902738e7cb88fe9 100644 (file)
@@ -294,7 +294,10 @@ yasm_x86__bc_apply_prefixes(x86_common *common, unsigned char *rex,
                 common->opersize = (unsigned char)prefixes[i] & 0xff;
                 if (common->mode_bits == 64 && common->opersize == 64 &&
                     def_opersize_64 != 64) {
-                    if (*rex == 0xff)
+                    if (!rex)
+                        yasm_warn_set(YASM_WARN_GENERAL,
+                                      N_("ignoring REX prefix on jump"));
+                    else if (*rex == 0xff)
                         yasm_warn_set(YASM_WARN_GENERAL,
                             N_("REX prefix not allowed on this instruction, ignoring"));
                     else