aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-10-28 21:23:21 +0200
committerArnold D. Robbins <arnold@skeeve.com>2015-10-28 21:23:21 +0200
commitd46e39f0f9c85a784ae08648fe3d57d96711bbef (patch)
treed003736435683e7142fb60cbefbf2397d76bedab
parentc054617e777c435acafcdb7e89a3217cef60178e (diff)
parentb90d6abb81f54bec11305d5091532c8d5fc47a18 (diff)
downloadegawk-d46e39f0f9c85a784ae08648fe3d57d96711bbef.tar.gz
egawk-d46e39f0f9c85a784ae08648fe3d57d96711bbef.tar.bz2
egawk-d46e39f0f9c85a784ae08648fe3d57d96711bbef.zip
Merge branch 'gawk-4.1-stable'
-rw-r--r--ChangeLog5
-rw-r--r--awkgram.c4
-rw-r--r--awkgram.y4
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/nulinsrc.awkbin0 -> 3 bytes
-rw-r--r--test/nulinsrc.ok2
9 files changed, 32 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 7017741f..2ee2a696 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (nextc): Don't allow '\0' even if check_for_bad
+ is false. Fixes a problem reported by Hanno Boeck <hanno@hboeck.de>.
+
2015-10-25 Arnold D. Robbins <arnold@skeeve.com>
* awkgram.y (yylex): Fix invalid write problems.
diff --git a/awkgram.c b/awkgram.c
index b37ee57a..efe9e98a 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -5489,7 +5489,7 @@ again:
0 : work_ring_idx + 1;
cur_char_ring[work_ring_idx] = 0;
}
- if (check_for_bad)
+ if (check_for_bad || *lexptr == '\0')
check_bad_char(*lexptr);
return (int) (unsigned char) *lexptr++;
@@ -5498,7 +5498,7 @@ again:
if (lexeof)
return END_FILE;
if (lexptr && lexptr < lexend) {
- if (check_for_bad)
+ if (check_for_bad || *lexptr == '\0')
check_bad_char(*lexptr);
return ((int) (unsigned char) *lexptr++);
}
diff --git a/awkgram.y b/awkgram.y
index 7805f144..2f8064ec 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -3069,7 +3069,7 @@ again:
0 : work_ring_idx + 1;
cur_char_ring[work_ring_idx] = 0;
}
- if (check_for_bad)
+ if (check_for_bad || *lexptr == '\0')
check_bad_char(*lexptr);
return (int) (unsigned char) *lexptr++;
@@ -3078,7 +3078,7 @@ again:
if (lexeof)
return END_FILE;
if (lexptr && lexptr < lexend) {
- if (check_for_bad)
+ if (check_for_bad || *lexptr == '\0')
check_bad_char(*lexptr);
return ((int) (unsigned char) *lexptr++);
}
diff --git a/test/ChangeLog b/test/ChangeLog
index 1028be70..c3f6c218 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (nulinsrc): New test.
+ * nulinsrc.awk, nulinsrc.ok: New files.
+
2015-10-26 Arnold D. Robbins <arnold@skeeve.com>
* id.awk: Sort the output. Helps on z/OS.
diff --git a/test/Makefile.am b/test/Makefile.am
index 5fda72a1..090ad0ea 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -649,6 +649,8 @@ EXTRA_DIST = \
noparms.ok \
nors.in \
nors.ok \
+ nulinsrc.awk \
+ nulinsrc.ok \
nulrsend.awk \
nulrsend.in \
nulrsend.ok \
@@ -1084,7 +1086,7 @@ BASIC_TESTS = \
manglprm math membug1 messages minusstr mmap8k mtchi18n \
nasty nasty2 negexp negrange nested nfldstr nfloop nfneg nfset nlfldsep \
nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \
- noparms nors nulrsend numindex numsubstr \
+ noparms nors nulinsrc nulrsend numindex numsubstr \
octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \
paramasfunc1 paramasfunc2 \
paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
diff --git a/test/Makefile.in b/test/Makefile.in
index dc1b3cad..a00f887c 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -906,6 +906,8 @@ EXTRA_DIST = \
noparms.ok \
nors.in \
nors.ok \
+ nulinsrc.awk \
+ nulinsrc.ok \
nulrsend.awk \
nulrsend.in \
nulrsend.ok \
@@ -1340,7 +1342,7 @@ BASIC_TESTS = \
manglprm math membug1 messages minusstr mmap8k mtchi18n \
nasty nasty2 negexp negrange nested nfldstr nfloop nfneg nfset nlfldsep \
nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \
- noparms nors nulrsend numindex numsubstr \
+ noparms nors nulinsrc nulrsend numindex numsubstr \
octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \
paramasfunc1 paramasfunc2 \
paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
@@ -3173,6 +3175,11 @@ noparms:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nulinsrc:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nulrsend:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 3035b0c6..5b4f3d43 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -550,6 +550,11 @@ noparms:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nulinsrc:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nulrsend:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/nulinsrc.awk b/test/nulinsrc.awk
new file mode 100644
index 00000000..aecda862
--- /dev/null
+++ b/test/nulinsrc.awk
Binary files differ
diff --git a/test/nulinsrc.ok b/test/nulinsrc.ok
new file mode 100644
index 00000000..515f423c
--- /dev/null
+++ b/test/nulinsrc.ok
@@ -0,0 +1,2 @@
+gawk: nulinsrc.awk:1: fatal: PEBKAC error: invalid character '\000' in source code
+EXIT CODE: 2