From: Akim Demaille Date: Mon, 4 Mar 2002 12:06:07 +0000 (+0000) Subject: * src/lex.c (parse_percent_token): Be sure to 0-end token_buffer X-Git-Tag: BISON-1_49a~125 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/550245801ebf0b39ba470fa5e9be8eb8a576134b * src/lex.c (parse_percent_token): Be sure to 0-end token_buffer before returning. Reported by Benoit Perrot. --- diff --git a/ChangeLog b/ChangeLog index c816b007..cb69ee05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-03-04 Akim Demaille + + * src/lex.c (parse_percent_token): Be sure to 0-end token_buffer + before returning. + Reported by Benoit Perrot. + 2002-03-04 Akim Demaille Use bitset operations when possible, not loops over bits. diff --git a/THANKS b/THANKS index c6eef723..9186c0ff 100644 --- a/THANKS +++ b/THANKS @@ -7,6 +7,7 @@ Albert Chin-A-Young china@thewrittenword.com Alexander Belopolsky alexb@rentec.com Andreas Schwab schwab@suse.de Arnold Robbins arnold@skeeve.com +Benoit Perrot benoit.perrot@epita.fr Bruce Lilly blilly@erols.com Cris van Pelt cris@amf03054.office.wxs.nl Daniel Hagerty hag@gnu.org diff --git a/src/lex.c b/src/lex.c index 489fdf9c..5b77f248 100644 --- a/src/lex.c +++ b/src/lex.c @@ -485,44 +485,40 @@ parse_percent_token (void) obstack_1grow (&token_obstack, '%'); obstack_1grow (&token_obstack, c); - switch (c) + if (!isalpha (c)) { - case '%': + obstack_1grow (&token_obstack, '\0'); token_buffer = obstack_finish (&token_obstack); - return tok_two_percents; - case '{': - token_buffer = obstack_finish (&token_obstack); - return tok_percent_left_curly; + switch (c) + { + case '%': + return tok_two_percents; - /* The following guys are here for backward compatibility with - very ancient Yacc versions. The paper of Johnson mentions - them (as ancient :). */ - case '<': - token_buffer = obstack_finish (&token_obstack); - return tok_left; + case '{': + return tok_percent_left_curly; - case '>': - token_buffer = obstack_finish (&token_obstack); - return tok_right; + /* The following guys are here for backward compatibility with + very ancient Yacc versions. The paper of Johnson mentions + them (as ancient :). */ + case '<': + return tok_left; - case '2': - token_buffer = obstack_finish (&token_obstack); - return tok_nonassoc; + case '>': + return tok_right; - case '0': - token_buffer = obstack_finish (&token_obstack); - return tok_token; + case '2': + return tok_nonassoc; - case '=': - token_buffer = obstack_finish (&token_obstack); - return tok_prec; - } + case '0': + return tok_token; - if (!isalpha (c)) - { - token_buffer = obstack_finish (&token_obstack); - return tok_illegal; + case '=': + return tok_prec; + + default: + return tok_illegal; + } } while (c = getc (finput), isalpha (c) || c == '_' || c == '-')