Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JRuby can pass invalid
\x{...}code point escapes in UTF-16 and UTF-32 regexps to Joni. With Joni 2.2.10, a short invalid escape such as\x{D801}encoded as UTF-16LE remains in compilation and loops inOptExactInfo.concatStrinstead of raising. This validates Unicode scalar values before compilation and raises the existingRegexpErrorfor surrogate and out-of-range values. Valid supplementary code points still compile and match.The regression covers the invalid and valid UTF-16/32 cases added in CRuby PR #20002, including the upstream test.
Joni remains the engine-level failure point: its optimizer should also avoid looping when an encoding reports a zero-length character. This JRuby change rejects the invalid scalar before handing it to Joni; it does not change Joni itself.
Verification
PATH="$JAVA_HOME/bin:$PATH" ./mvnw -q -o -DskipTests -pl core,shaded packagePATH="$JAVA_HOME/bin:$PATH" bin/jruby spec/mspec/bin/mspec-run spec/ruby/core/regexp/encoding_spec.rb— 14 examples, 42 expectations, 0 failures/errors.RegexpError; valid U+1F600 patterns matched.