scan: fix typo in UTF-8 escape
commit952479fca7944f629b8c4d705f05c6987c4747a4
authorAkim Demaille <akim.demaille@gmail.com>
Tue, 3 Aug 2021 08:19:37 +0000 (3 10:19 +0200)
committerAkim Demaille <akim.demaille@gmail.com>
Tue, 3 Aug 2021 10:22:52 +0000 (3 12:22 +0200)
tree76a9ee0b5d99dff03440c2051d308dba4b4a216d
parente14825ecb7faa849c77b8e0396ec9c30ee4518f6
scan: fix typo in UTF-8 escape

We had:

```
-mbchar    ...|\xF0[\x\90-\xBF]([\x80-\xBF]{2})|...
+mbchar    ...|\xF0[\x90-\xBF]([\x80-\xBF]{2})|...
```

so a precise sequence that matches the incorrect regex can let NUL
bytes pass through, which triggers an assertion violation downstream.
It is a pity that Flex does not report an error for such input.

Reported by Ahcheong Lee <ahcheong.lee@gmail.com>.
<https://lists.gnu.org/r/bug-bison/2021-04/msg00003.html>

* src/scan-gram.l (mbchar): Fix the bad regex.
* tests/input.at (Invalid inputs): Check that case.
src/scan-gram.l
tests/input.at