]> granicus.if.org Git - yasm/commitdiff
Fix crash case in data bytecode handling (raw followed by non-raw value).
authorPeter Johnson <peter@tortall.net>
Thu, 12 Oct 2006 03:10:14 +0000 (03:10 -0000)
committerPeter Johnson <peter@tortall.net>
Thu, 12 Oct 2006 03:10:14 +0000 (03:10 -0000)
Reported by: Danny Reeves <danny_reeves@hotmail.com>

svn path=/trunk/yasm/; revision=1646

libyasm/bc-data.c
libyasm/tests/Makefile.inc
libyasm/tests/data-rawvalue.asm [new file with mode: 0644]
libyasm/tests/data-rawvalue.hex [new file with mode: 0644]

index 5c6f7fca35388034d1341d3419a873a488927a17..6e025c53f272d9dd18230b2f7b99cea26f05c43f 100644 (file)
@@ -300,6 +300,8 @@ yasm_bc_create_data(yasm_datavalhead *datahead, unsigned int size,
                                                  &dvo->data.raw.contents[len],
                                                  1);
                } else {
+                   if (len > 0)
+                       dvo = STAILQ_NEXT(dvo, link);
                    dvo->type = dv->type;
                    dvo->data.val = dv->data.val;   /* structure copy */
                    dvo->data.val.size = size*8;    /* remember size */
index f34f651c25cd89ba80dc96ff03e7d0bf542a0d82..d53e3185ef3c7b274c82881ee2f7a0b923b9336a 100644 (file)
@@ -12,6 +12,8 @@ EXTRA_DIST += libyasm/tests/absloop-err.asm
 EXTRA_DIST += libyasm/tests/absloop-err.errwarn
 EXTRA_DIST += libyasm/tests/charconst64.asm
 EXTRA_DIST += libyasm/tests/charconst64.hex
+EXTRA_DIST += libyasm/tests/data-rawvalue.asm
+EXTRA_DIST += libyasm/tests/data-rawvalue.hex
 EXTRA_DIST += libyasm/tests/duplabel-err.asm
 EXTRA_DIST += libyasm/tests/duplabel-err.errwarn
 EXTRA_DIST += libyasm/tests/emptydata.asm
diff --git a/libyasm/tests/data-rawvalue.asm b/libyasm/tests/data-rawvalue.asm
new file mode 100644 (file)
index 0000000..3ebc7d0
--- /dev/null
@@ -0,0 +1,3 @@
+x      db 0
+dd     0,x,0
+
diff --git a/libyasm/tests/data-rawvalue.hex b/libyasm/tests/data-rawvalue.hex
new file mode 100644 (file)
index 0000000..089b49c
--- /dev/null
@@ -0,0 +1,13 @@
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00 
+00