gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-760


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-760-g611dc46
Date: Sun, 11 Oct 2015 17:47:13 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-4.1-stable has been updated
       via  611dc46d8b216c22f05604e8df6bee7aa59e5977 (commit)
      from  de3ff3362c135fabe1309c3b1b7ceb4a6d3eb277 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=611dc46d8b216c22f05604e8df6bee7aa59e5977

commit 611dc46d8b216c22f05604e8df6bee7aa59e5977
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Oct 11 20:46:55 2015 +0300

    Bug fix, invalid read in yylex.

diff --git a/ChangeLog b/ChangeLog
index a23e23a..4eea7fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-11         Arnold D. Robbins     <address@hidden>
+
+       * awkgram.y (yylex): Fix invalid read problems.
+       Reported by Hanno Boeck <address@hidden>.
+
 2015-10-04         Arnold D. Robbins     <address@hidden>
 
        * configure.ac: Bump version to 4.1.3a.
diff --git a/awkgram.c b/awkgram.c
index 9ced0da..845dbbe 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -142,8 +142,8 @@ const char *const ruletab[] = {
 static bool in_print = false;  /* lexical scanning kludge for print */
 static int in_parens = 0;      /* lexical scanning kludge for print */
 static int sub_counter = 0;    /* array dimension counter for use in delete */
-static char *lexptr = NULL;            /* pointer to next char during parsing 
*/
-static char *lexend;
+static char *lexptr;           /* pointer to next char during parsing */
+static char *lexend;           /* end of buffer */
 static char *lexptr_begin;     /* keep track of where we were for error msgs */
 static char *lexeme;           /* beginning of lexeme for debugging */
 static bool lexeof;            /* seen EOF for current source? */  
@@ -4450,7 +4450,8 @@ yyerror(const char *m, ...)
                if (thisline == NULL) {
                        cp = lexeme;
                        if (*cp == '\n') {
-                               cp--;
+                               if (cp > lexptr_begin)
+                                       cp--;
                                mesg = _("unexpected newline or end of string");
                        }
                        for (; cp != lexptr_begin && *cp != '\n'; --cp)
@@ -4461,6 +4462,8 @@ yyerror(const char *m, ...)
                }
                /* NL isn't guaranteed */
                bp = lexeme;
+               if (bp < thisline)
+                       bp = thisline + 1;
                while (bp < lexend && *bp && *bp != '\n')
                        bp++;
        } else {
diff --git a/awkgram.y b/awkgram.y
index cb41cf3..1177160 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -102,8 +102,8 @@ const char *const ruletab[] = {
 static bool in_print = false;  /* lexical scanning kludge for print */
 static int in_parens = 0;      /* lexical scanning kludge for print */
 static int sub_counter = 0;    /* array dimension counter for use in delete */
-static char *lexptr = NULL;            /* pointer to next char during parsing 
*/
-static char *lexend;
+static char *lexptr;           /* pointer to next char during parsing */
+static char *lexend;           /* end of buffer */
 static char *lexptr_begin;     /* keep track of where we were for error msgs */
 static char *lexeme;           /* beginning of lexeme for debugging */
 static bool lexeof;            /* seen EOF for current source? */  
@@ -2111,7 +2111,8 @@ yyerror(const char *m, ...)
                if (thisline == NULL) {
                        cp = lexeme;
                        if (*cp == '\n') {
-                               cp--;
+                               if (cp > lexptr_begin)
+                                       cp--;
                                mesg = _("unexpected newline or end of string");
                        }
                        for (; cp != lexptr_begin && *cp != '\n'; --cp)
@@ -2122,6 +2123,8 @@ yyerror(const char *m, ...)
                }
                /* NL isn't guaranteed */
                bp = lexeme;
+               if (bp < thisline)
+                       bp = thisline + 1;
                while (bp < lexend && *bp && *bp != '\n')
                        bp++;
        } else {
diff --git a/test/ChangeLog b/test/ChangeLog
index 2199f56..8792af9 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-11         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (readbuf): New test.
+       * readbuf.awk, readbuf.ok: New files.
+
 2015-09-26         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (muldimposix): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 56fd5da..0d8658a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -760,6 +760,8 @@ EXTRA_DIST = \
        range1.awk \
        range1.in \
        range1.ok \
+       readbuf.awk \
+       readbuf.ok \
        readdir.awk \
        readdir0.awk \
        readfile2.awk \
@@ -1044,7 +1046,8 @@ BASIC_TESTS = \
        paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
        pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \
        prt1eval prtoeval \
-       rand range1 rebrackloc rebt8b1 redfilnm regeq regexpbrack regexpbrack2 \
+       rand range1 readbuf rebrackloc rebt8b1 redfilnm \
+       regeq regexpbrack regexpbrack2 \
        regexprange regrange reindops \
        reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \
        rstest3 rstest4 rstest5 rswhite \
diff --git a/test/Makefile.in b/test/Makefile.in
index 7963cfb..7917fc2 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1017,6 +1017,8 @@ EXTRA_DIST = \
        range1.awk \
        range1.in \
        range1.ok \
+       readbuf.awk \
+       readbuf.ok \
        readdir.awk \
        readdir0.awk \
        readfile2.awk \
@@ -1300,7 +1302,8 @@ BASIC_TESTS = \
        paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
        pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \
        prt1eval prtoeval \
-       rand range1 rebrackloc rebt8b1 redfilnm regeq regexpbrack regexpbrack2 \
+       rand range1 readbuf rebrackloc rebt8b1 redfilnm \
+       regeq regexpbrack regexpbrack2 \
        regexprange regrange reindops \
        reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \
        rstest3 rstest4 rstest5 rswhite \
@@ -3238,6 +3241,11 @@ range1:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+readbuf:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 rebrackloc:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 7c55a44..1723c33 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -702,6 +702,11 @@ range1:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+readbuf:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 rebrackloc:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/readbuf.awk b/test/readbuf.awk
new file mode 100644
index 0000000..b7512db
--- /dev/null
+++ b/test/readbuf.awk
@@ -0,0 +1,2 @@
+
+{
diff --git a/test/readbuf.ok b/test/readbuf.ok
new file mode 100644
index 0000000..110a26b
--- /dev/null
+++ b/test/readbuf.ok
@@ -0,0 +1,3 @@
+gawk: readbuf.awk:2: {
+gawk: readbuf.awk:2: ^ unexpected newline or end of string
+EXIT CODE: 1

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |    5 +++++
 awkgram.c        |    9 ++++++---
 awkgram.y        |    9 ++++++---
 test/ChangeLog   |    5 +++++
 test/Makefile.am |    5 ++++-
 test/Makefile.in |   10 +++++++++-
 test/Maketests   |    5 +++++
 test/readbuf.awk |    2 ++
 test/readbuf.ok  |    3 +++
 9 files changed, 45 insertions(+), 8 deletions(-)
 create mode 100644 test/readbuf.awk
 create mode 100644 test/readbuf.ok


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]