Hi Martin, Thanks for the report!
> Le 16 nov. 2020 à 16:05, Martin Rehak <[email protected]> a écrit : > > Hello, > > 4. input.at:83: testing Invalid inputs ... Yeah, that test, in itself, was tricky to write. Someone at some point reported a file a fuzzer built, and it was full of garbage. So much that I had troubles writing this file in the test suite itself (i.e., unrelated to Bison). > This is the input.y: > > $ xxd input.y > 00000000: 0001 02ff 3f0a 2200 220a 2525 0a3f 0a64 ....?.".".%%.?.d > 00000010: 6566 6175 6c74 3a20 2761 2720 7d0a 2526 efault: 'a' }.%& > 00000020: 0a25 612d 646f 6573 2d6e 6f74 2d65 7869 .%a-does-not-exi > 00000030: 7374 0a25 2d0a 257b 0a st.%-.%{. It looks like what is expected. It's "source" is: \000\001\002\377? "\000" %% ? default: 'a' } %& %a-does-not-exist %- %{ > This test (3) passes on bison-3.4.2. This is stderr from there: > > input.y:1.1-2: error: invalid characters: '\0\001\002\377?' > input.y:3.1: error: invalid character: '?' > input.y:4.14: error: invalid character: '}' > input.y:5.1: error: invalid character: '%' > input.y:5.2: error: invalid character: '&' > input.y:6.1-17: error: invalid directive: '%a-does-not-exist' > input.y:7.1: error: invalid character: '%' > input.y:7.2: error: invalid character: '-' > input.y:8.1-9.0: error: missing '%}' at end of file > input.y:8.1-9.0: error: syntax error, unexpected %{...%} These part does not seem to the problem. It is when bison wants to quote the source file that it seems to drop the \0. Could you please try this? $ printf "\0\n" > /tmp/foo.y $ LC_ALL=C ./src/bison -fcaret /tmp/foo.y 2>&1 /tmp/foo.y:1.1: error: invalid character: '\0' 1 | | ^ $ LC_ALL=C ./src/bison -fcaret /tmp/foo.y 2>&1 | od -ax - 0000000 / t m p / f o o . y : 1 . 1 : sp 742f 706d 662f 6f6f 792e 313a 312e 203a 0000020 e r r o r : sp i n v a l i d sp c 7265 6f72 3a72 6920 766e 6c61 6469 6320 0000040 h a r a c t e r : sp ' \ 0 ' nl sp 6168 6172 7463 7265 203a 5c27 2730 200a 0000060 sp sp sp 1 sp | sp nul nl sp sp sp sp sp sp | 2020 3120 7c20 0020 200a 2020 2020 7c20 0000100 sp ^ nl 5e20 000a 0000103 As you can see in the od output, I do get the NUL byte in the quoted source line: 0000060 sp sp sp 1 sp | sp ***nul*** nl sp sp sp sp sp sp | Do you have it too? Cheers!
