git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH RESEND] t7812: test PCRE2 whitespace bug

From
René Scharfe <l.s.r@web.de>
Date
Apr 8, 2022, 16:21 UTC
Message-ID
<3a49649d-8ff9-e5a7-e3fd-33fee5068ae8@web.de>

Check if git grep works around the PCRE2 big fixed by their e0c6029 (Fix inifinite loop when a single byte newline is searched in JIT., 2020-05-29), which affects version 10.35 and earlier.

Searching for leading whitespace also triggers the endless loop. Set a one-second alarm to abort in case we do get hit by the bug, to avoid having to wait forever for the test result.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
---
Original submission:
https://lore.kernel.org/git/1187feda-c14a-f75c-6e09-4df101f00056@web.de/
 t/t7812-grep-icase-non-ascii.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh
index 9047d665a1..ac7be54714 100755
--- a/t/t7812-grep-icase-non-ascii.sh
+++ b/t/t7812-grep-icase-non-ascii.sh
@@ -4,6 +4,10 @@ test_description='grep icase on non-English locales'

 . ./lib-gettext.sh

+doalarm () {
+	perl -e 'alarm shift; exec @ARGV' -- "$@"
+}
+
 test_expect_success GETTEXT_LOCALE 'setup' '
 	test_write_lines "TILRAUN: Halló Heimur!" >file &&
 	git add file &&
@@ -139,4 +143,10 @@ test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep non-literal ASCII fro
 	test_cmp expected actual
 '

+test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep avoid endless loop bug' '
+	echo " Halló" >leading-whitespace &&
+	git add leading-whitespace &&
+	doalarm 1 git grep --perl-regexp "^\s" leading-whitespace
+'
+
 test_done
--
2.35.1
Message 1 of 1 in “t7812: test PCRE2 whitespace bug”
  1. t7812: test PCRE2 whitespace bugRené Scharfe, Apr 8, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.