* nasm-preproc.c (nasm_preproc_input): Don't generate %line except at the

beginning of a line.  The old way could insert a %line in the middle of very
long lines (e.g. >8192 chars).
* longline.asm: Test with an ~8500 character line.

Reported by: Brian Gladman <brg@gladman.plus.com>

svn path=/trunk/yasm/; revision=1506
0.5.0
Peter Johnson 19 years ago
parent 369c628a28
commit 85380b9692
  1. 2
      modules/preprocs/nasm/nasm-preproc.c
  2. 3
      modules/preprocs/nasm/tests/Makefile.inc
  3. 2
      modules/preprocs/nasm/tests/longline.asm
  4. 0
      modules/preprocs/nasm/tests/longline.errwarn
  5. 64
      modules/preprocs/nasm/tests/longline.hex

@ -169,7 +169,6 @@ nasm_preproc_input(yasm_preproc *preproc, char *buf, size_t max_size)
preproc_nasm->linepos = preproc_nasm->line; preproc_nasm->linepos = preproc_nasm->line;
preproc_nasm->lineleft = strlen(preproc_nasm->line) + 1; preproc_nasm->lineleft = strlen(preproc_nasm->line) + 1;
preproc_nasm->line[preproc_nasm->lineleft-1] = '\n'; preproc_nasm->line[preproc_nasm->lineleft-1] = '\n';
}
altline = nasm_src_get(&linnum, &preproc_nasm->file_name); altline = nasm_src_get(&linnum, &preproc_nasm->file_name);
if (altline) { if (altline) {
@ -192,6 +191,7 @@ nasm_preproc_input(yasm_preproc *preproc, char *buf, size_t max_size)
yasm_xfree(preproc_nasm->file_name); yasm_xfree(preproc_nasm->file_name);
preproc_nasm->file_name = NULL; preproc_nasm->file_name = NULL;
} }
}
n = preproc_nasm->lineleft<max_size?preproc_nasm->lineleft:max_size; n = preproc_nasm->lineleft<max_size?preproc_nasm->lineleft:max_size;
strncpy(buf, preproc_nasm->linepos, n); strncpy(buf, preproc_nasm->linepos, n);

@ -5,6 +5,9 @@ TESTS += modules/preprocs/nasm/tests/nasmpp_test.sh
EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp_test.sh EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp_test.sh
EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.asm EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.asm
EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.errwarn EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/longline.asm
EXTRA_DIST += modules/preprocs/nasm/tests/longline.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/longline.hex
EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.asm EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.asm
EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.errwarn EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-bigint.asm EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-bigint.asm

File diff suppressed because one or more lines are too long

@ -0,0 +1,64 @@
51
f4
a7
50
51
f4
a7
50
7e
41
65
53
7e
41
65
53
1a
17
a4
c3
1a
17
a4
c3
3a
27
5e
96
3a
27
5e
96
3b
ab
6b
cb
3b
ab
6b
cb
1f
9d
45
f1
1f
9d
45
f1
ac
fa
58
ab
ac
fa
58
ab
4b
e3
03
93
4b
e3
03
93
Loading…
Cancel
Save