From f73e20158641a96882565852d0e2a6bf1540d950 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 29 Apr 2021 00:31:06 +0200 Subject: lexer: fix infinite loop when parsing regexp literal at EOF Signed-off-by: Jo-Philipp Wich --- tests/custom/03_bugs/16_hang_on_regexp_at_eof | 9 +++++++++ tests/custom/run_tests.sh | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 tests/custom/03_bugs/16_hang_on_regexp_at_eof (limited to 'tests') diff --git a/tests/custom/03_bugs/16_hang_on_regexp_at_eof b/tests/custom/03_bugs/16_hang_on_regexp_at_eof new file mode 100644 index 0000000..d8702ca --- /dev/null +++ b/tests/custom/03_bugs/16_hang_on_regexp_at_eof @@ -0,0 +1,9 @@ +When parsing a regexp literal at the end of the source buffer, the lexer +ended up in an infinite loop watining for a non-flag character. + +-- Expect stdout -- +-- End -- + +-- Testcase -- +{% /a/ +-- End (no-eol) -- diff --git a/tests/custom/run_tests.sh b/tests/custom/run_tests.sh index 61b116f..db64021 100755 --- a/tests/custom/run_tests.sh +++ b/tests/custom/run_tests.sh @@ -28,6 +28,11 @@ extract_sections() { outfile=$(printf "%s/%03d.%s" "$dir" $count "$tag") printf "" > "$outfile" ;; + "-- End (no-eol) --") + truncate -s -1 "$outfile" + tag="" + outfile="" + ;; "-- End --") tag="" outfile="" -- cgit v1.2.3