Skip to content

fix bad-UTF-8 check in ParseUnicodeGroup#648

Open
arib06 wants to merge 1 commit into
google:mainfrom
arib06:unicode-group-bad-utf8
Open

fix bad-UTF-8 check in ParseUnicodeGroup#648
arib06 wants to merge 1 commit into
google:mainfrom
arib06:unicode-group-bad-utf8

Conversation

@arib06

@arib06 arib06 commented Jul 4, 2026

Copy link
Copy Markdown

ParseUnicodeGroup validates the first rune after \p or \P with !StringViewToRune(...), but that helper returns -1 on failure and a positive byte count on success, so the negation never catches a decode error. A pattern like \p followed by an invalid UTF-8 byte is then reported as kRegexpBadCharRange rather than kRegexpBadUTF8, unlike the \p{...} form which reports bad UTF-8. Compare the result with < 0 as the other StringViewToRune call sites do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant