From 4a9498de86e4378f42c932ee7ee956e0bc002d97 Mon Sep 17 00:00:00 2001 From: Kartik Naik Date: Mon, 24 Aug 2026 23:29:42 +0530 Subject: [PATCH] fix stale byte in negated glob class with glob_no_wild_separator --- src/pcre2_convert.c | 3 ++- testdata/testinput24 | 6 ++++++ testdata/testoutput24 | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/pcre2_convert.c b/src/pcre2_convert.c index 8a2b293d5..8a525f50c 100644 --- a/src/pcre2_convert.c +++ b/src/pcre2_convert.c @@ -679,9 +679,10 @@ if (*pattern == CHAR_EXCLAMATION_MARK len++; } out->out_str[len] = (uint8_t) separator; + len++; } - convert_glob_write_str(out, len + 1); + convert_glob_write_str(out, len); } else convert_glob_write(out, CHAR_LEFT_SQUARE_BRACKET); diff --git a/testdata/testinput24 b/testdata/testinput24 index 03cecf9b2..c024ebaa4 100644 --- a/testdata/testinput24 +++ b/testdata/testinput24 @@ -330,6 +330,12 @@ /??a??/ +/[!a]/ + +/[^xy]/ + +/a*[!b]/ + #pattern convert=unset #pattern convert=glob,convert_glob_escape=0 diff --git a/testdata/testoutput24 b/testdata/testoutput24 index feac50249..1daf6cfb9 100644 --- a/testdata/testoutput24 +++ b/testdata/testoutput24 @@ -512,6 +512,15 @@ No match /??a??/ (?s)\A..a..\z +/[!a]/ +(?s)\A[^a]\z + +/[^xy]/ +(?s)\A[^xy]\z + +/a*[!b]/ +(?s)\Aa(*COMMIT).*?[^b]\z + #pattern convert=unset #pattern convert=glob,convert_glob_escape=0