]> granicus.if.org Git - yasm/commitdiff
Fix invalid memory access on macro with multiple of 16 arguments.
authorPeter Johnson <peter@tortall.net>
Sun, 10 Sep 2006 19:44:18 +0000 (19:44 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 10 Sep 2006 19:44:18 +0000 (19:44 -0000)
Patch by: Mathieu Monnier <mathieu.monnier@polytechnique.org>

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

modules/preprocs/nasm/nasm-pp.c
modules/preprocs/nasm/tests/16args.asm [new file with mode: 0644]
modules/preprocs/nasm/tests/16args.errwarn [new file with mode: 0644]
modules/preprocs/nasm/tests/16args.hex [new file with mode: 0644]
modules/preprocs/nasm/tests/Makefile.inc

index 823b4bc29c47b618cb7d16f909542d59093650bd..97d49ce33b6ba3b029bccf92682930f708fa7abf 100644 (file)
@@ -1376,7 +1376,7 @@ count_mmac_params(Token * t, int *nparam, Token *** params)
     *params = NULL;
     while (t)
     {
-       if (*nparam >= paramsize)
+       if (*nparam+1 >= paramsize)
        {
            paramsize += PARAM_DELTA;
            *params = nasm_realloc(*params, sizeof(**params) * paramsize);
diff --git a/modules/preprocs/nasm/tests/16args.asm b/modules/preprocs/nasm/tests/16args.asm
new file mode 100644 (file)
index 0000000..506db96
--- /dev/null
@@ -0,0 +1,27 @@
+%define BLA16 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
+
+%macro SUPERBLA16 16
+mov eax, %1
+mov eax, %2
+mov eax, %3
+mov eax, %4
+mov eax, %5
+mov eax, %6
+mov eax, %7
+mov eax, %8
+mov eax, %9
+mov eax, %10
+mov eax, %11
+mov eax, %12
+mov eax, %13
+mov eax, %14
+mov eax, %15
+mov eax, %16
+%endmacro
+
+SECTION .text
+
+yoyo:
+
+SUPERBLA16 BLA16
+
diff --git a/modules/preprocs/nasm/tests/16args.errwarn b/modules/preprocs/nasm/tests/16args.errwarn
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/modules/preprocs/nasm/tests/16args.hex b/modules/preprocs/nasm/tests/16args.hex
new file mode 100644 (file)
index 0000000..2eaa59d
--- /dev/null
@@ -0,0 +1,96 @@
+66 
+b8 
+01 
+00 
+00 
+00 
+66 
+b8 
+02 
+00 
+00 
+00 
+66 
+b8 
+03 
+00 
+00 
+00 
+66 
+b8 
+04 
+00 
+00 
+00 
+66 
+b8 
+05 
+00 
+00 
+00 
+66 
+b8 
+06 
+00 
+00 
+00 
+66 
+b8 
+07 
+00 
+00 
+00 
+66 
+b8 
+08 
+00 
+00 
+00 
+66 
+b8 
+09 
+00 
+00 
+00 
+66 
+b8 
+0a 
+00 
+00 
+00 
+66 
+b8 
+0b 
+00 
+00 
+00 
+66 
+b8 
+0c 
+00 
+00 
+00 
+66 
+b8 
+0d 
+00 
+00 
+00 
+66 
+b8 
+0e 
+00 
+00 
+00 
+66 
+b8 
+0f 
+00 
+00 
+00 
+66 
+b8 
+10 
+00 
+00 
+00 
index 2dd9d02d3736a64f9d0aa18a6cb084daeaf48234..54faa00f70876d6a797941438e0740df8f78cb7e 100644 (file)
@@ -3,6 +3,9 @@
 TESTS += modules/preprocs/nasm/tests/nasmpp_test.sh
 
 EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp_test.sh
+EXTRA_DIST += modules/preprocs/nasm/tests/16args.asm
+EXTRA_DIST += modules/preprocs/nasm/tests/16args.errwarn
+EXTRA_DIST += modules/preprocs/nasm/tests/16args.hex
 EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.asm
 EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.errwarn
 EXTRA_DIST += modules/preprocs/nasm/tests/longline.asm