bison-patches
[Top][All Lists]
Advanced

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

FYI, Both: wwp segv


From: Akim Demaille
Subject: FYI, Both: wwp segv
Date: 01 Nov 2001 19:03:38 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * tests/regression.at (Invalid input: 2): New.
        * src/lex.c (unlexed_token_buffer): New.
        (lex, unlex): Adjust: when unlexing, be sure to save token_buffer
        too.
        Reported by Wwp.

Index: THANKS
===================================================================
RCS file: /cvsroot/bison/bison/THANKS,v
retrieving revision 1.10.2.6
diff -u -u -r1.10.2.6 THANKS
--- THANKS 2001/10/10 14:52:19 1.10.2.6
+++ THANKS 2001/11/01 18:03:01
@@ -23,6 +23,7 @@
 Richard Stallman        address@hidden
 Robert Anisko           address@hidden
 Shura                   address@hidden
+Wwp                     address@hidden
 
 Many people are not named here because we lost track of them.  We
 thank them!  Please, help us keeping this list up to date.
Index: src/lex.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.c,v
retrieving revision 1.33.2.7
diff -u -u -r1.33.2.7 lex.c
--- src/lex.c 2001/10/02 15:52:24 1.33.2.7
+++ src/lex.c 2001/11/01 18:03:01
@@ -35,12 +35,11 @@
 bucket *symval;
 int numval;
 
-/* these two describe a token to be reread */
+/* A token to be reread, see unlex and lex. */
 static token_t unlexed = tok_undef;
-/* by the next call to lex */
 static bucket *unlexed_symval = NULL;
+static const char *unlexed_token_buffer = NULL;
 
-
 void
 lex_init (void)
 {
@@ -324,6 +323,7 @@
 unlex (token_t token)
 {
   unlexed = token;
+  unlexed_token_buffer = token_buffer;
   unlexed_symval = symval;
 }
 
@@ -368,6 +368,7 @@
     {
       token_t res = unlexed;
       symval = unlexed_symval;
+      token_buffer = unlexed_token_buffer;
       unlexed = tok_undef;
       return res;
     }
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.1.2.4
diff -u -u -r1.1.2.4 regression.at
--- tests/regression.at 2001/10/02 16:17:41 1.1.2.4
+++ tests/regression.at 2001/11/01 18:03:02
@@ -109,6 +109,45 @@
 AT_CLEANUP
 
 
+## ----------------- ##
+## Invalid input 1.  ##
+## ----------------- ##
+
+
+AT_SETUP([Invalid input: 1])
+
+AT_DATA([input.y],
+[[%%
+?
+]])
+
+AT_CHECK([bison input.y], [1], [],
+[input.y:2: invalid input: `?'
+input.y:3: fatal error: no rules in the input grammar
+])
+
+AT_CLEANUP
+
+
+## ----------------- ##
+## Invalid input 2.  ##
+## ----------------- ##
+
+
+AT_SETUP([Invalid input: 2])
+
+AT_DATA([input.y],
+[[%%
+default: 'a' }
+]])
+
+AT_CHECK([bison input.y], [1], [],
+[input.y:2: invalid input: `}'
+])
+
+AT_CLEANUP
+
+
 ## --------------------- ##
 ## Invalid CPP headers.  ##
 ## --------------------- ##



reply via email to

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