Skip to content

Commit 2c08b61

Browse files
author
Zoltan Herczeg
committed
Fix an invalid match of ascii word classes when invalid utf is enabled
Fixes #224
1 parent 6454934 commit 2c08b61

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ the same time, fixed a typo in the Bazel file.
7575
17. Add PCRE2_EXTRA_ASCII_DIGIT to allow [:digit:] to be kept on sync with \d
7676
even in UCP mode.
7777

78+
18. Fix an invalid match of ascii word classes when invalid utf is enabled.
79+
80+
7881
Version 10.42 11-December-2022
7982
------------------------------
8083

src/pcre2_jit_compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4143,6 +4143,7 @@ if (negated)
41434143

41444144
if (common->invalid_utf)
41454145
{
4146+
OP1(SLJIT_MOV, TMP1, 0, TMP2, 0);
41464147
add_jump(compiler, &common->utfreadchar_invalid, JUMP(SLJIT_FAST_CALL));
41474148
add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR));
41484149
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);

src/pcre2_jit_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,6 +1981,7 @@ static const struct invalid_utf8_regression_test_case invalid_utf8_regression_te
19811981
{ PCRE2_UTF, CI, 0, 0, 0, 7, 11, { "#\xc7\x85#", NULL }, "\x80\x80#\xc7\x80\x80\x80#\xc7\x85#" },
19821982

19831983
{ PCRE2_UTF | PCRE2_UCP, CI, 0, 0, 0, -1, -1, { "[\\s]", NULL }, "\xed\xa0\x80" },
1984+
{ PCRE2_UTF, CI, 0, 0, 0, 1, 4, { "[\\D]", NULL }, "@\xe0\xab\xaa@" },
19841985

19851986
/* These two are not invalid UTF tests, but this infrastructure fits better for them. */
19861987
{ 0, PCRE2_JIT_COMPLETE, 0, 0, 1, -1, -1, { "\\X{2}", NULL }, "\r\n\n" },

0 commit comments

Comments
 (0)