scanner: don't crash on strings containing a NUL byte
commitbe95a4fe2951374676efc9454ffee8638faaf68d
authorAkim Demaille <akim.demaille@gmail.com>
Tue, 28 Jul 2020 16:51:30 +0000 (28 18:51 +0200)
committerAkim Demaille <akim.demaille@gmail.com>
Tue, 28 Jul 2020 17:01:48 +0000 (28 19:01 +0200)
treea06712b16c6e990cf4cb1e500b99dcccac9686e3
parent6accee7716294afd2e0a9b644935274c5ae6bdb0
scanner: don't crash on strings containing a NUL byte

We crash if the input contains a string containing a NUL byte.
Reported by Suhwan Song.
https://lists.gnu.org/r/bug-bison/2020-07/msg00051.html

* src/flex-scanner.h (STRING_FREE): Avoid accidental use of
last_string.
* src/scan-gram.l: Don't call STRING_FREE without calling
STRING_FINISH first.
* tests/input.at (Invalid inputs): Check that case.
THANKS
src/flex-scanner.h
src/scan-gram.l
tests/input.at