]> granicus.if.org Git - yasm/commitdiff
Fix #166: Off-by-one error in raw preproc caused hang on lines longer than
authorPeter Johnson <peter@tortall.net>
Tue, 27 Jan 2009 06:38:14 +0000 (06:38 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 27 Jan 2009 06:38:14 +0000 (06:38 -0000)
512 characters.

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

modules/preprocs/raw/Makefile.inc
modules/preprocs/raw/raw-preproc.c
modules/preprocs/raw/tests/Makefile.inc [new file with mode: 0644]
modules/preprocs/raw/tests/longline.asm [new file with mode: 0644]
modules/preprocs/raw/tests/longline.hex [new file with mode: 0644]
modules/preprocs/raw/tests/rawpp_test.sh [new file with mode: 0755]

index ad3ae673e7d277fbabe0e42292da10656b0cc433..aff8353d3a884d7150dca4cf15ba3048d34cb2f8 100644 (file)
@@ -3,3 +3,7 @@
 libyasm_a_SOURCES += modules/preprocs/raw/raw-preproc.c
 
 YASM_MODULES += preproc_raw
+
+EXTRA_DIST += modules/preprocs/raw/tests/Makefile.inc
+
+include modules/preprocs/raw/tests/Makefile.inc
index 463ceaa1399c260692c59667d084c493eb89bb1f..a441ad47093f2644212d8464d58c715609150bfc 100644 (file)
@@ -94,7 +94,7 @@ raw_preproc_get_line(yasm_preproc *preproc)
         p += strlen(p);
         if (p > buf && p[-1] == '\n')
             break;
-        if ((p-buf) >= bufsize) {
+        if ((p-buf)+1 >= bufsize) {
             /* Increase size of buffer */
             char *oldbuf = buf;
             bufsize *= 2;
diff --git a/modules/preprocs/raw/tests/Makefile.inc b/modules/preprocs/raw/tests/Makefile.inc
new file mode 100644 (file)
index 0000000..19b2792
--- /dev/null
@@ -0,0 +1,7 @@
+# $Id$
+
+TESTS += modules/preprocs/raw/tests/rawpp_test.sh
+
+EXTRA_DIST += modules/preprocs/nasm/tests/rawpp_test.sh
+EXTRA_DIST += modules/preprocs/nasm/tests/longline.asm
+EXTRA_DIST += modules/preprocs/nasm/tests/longline.hex
diff --git a/modules/preprocs/raw/tests/longline.asm b/modules/preprocs/raw/tests/longline.asm
new file mode 100644 (file)
index 0000000..2d5931a
--- /dev/null
@@ -0,0 +1 @@
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
diff --git a/modules/preprocs/raw/tests/longline.hex b/modules/preprocs/raw/tests/longline.hex
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/modules/preprocs/raw/tests/rawpp_test.sh b/modules/preprocs/raw/tests/rawpp_test.sh
new file mode 100755 (executable)
index 0000000..d57a529
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+# $Id$
+${srcdir}/out_test.sh rawpp_test modules/preprocs/raw/tests "raw preproc" "-f bin -r raw" ""
+exit $?