Repository navigation
Handle GB18030 length in multibyte case folding - #75
Merged
headius merged 2 commits intoNov 20, 2026
Merged
Conversation
Member
Author
|
This regression was not found until the released jcodings 1.0.66 hit JRuby's CI. I'm having the agent verify that these changes fix and do not regress any tests in JRuby before proceeding with a second release. |
headius
marked this pull request as ready for review
November 20, 2026 00:02
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 PR #10121 resolves JCodings 1.0.66, where the shared multibyte case-fold helper calls
length(byte). GB18030 passes a nullEncLentable because its character length comes from its transition table, so MRITestGB18030#test_mbc_case_foldfails with an NPE surfaced asRegexpError.For an encoding without a per-byte length table, the helper now derives the length with the encoding-specific
length(bytes, p, bytes.length)implementation. It keeps malformed or truncated lengths positive and clips copying to the actual backing-array boundary.The source audit found no other helper caller with this root cause:
EncLentables.UnicodeEncoding.mbcCaseFoldoverrides this helper.The regression tests cover GB18030's 2-byte and 4-byte sequences with the logical end inside the character, plus representative split-boundary cases for every other concrete encoding that calls the shared helper.
Verification on Java 21:
TestGB18030,TestEmacsMule, andTestCaseMap— 12 tests, 0 failures/errors.test_mri/ruby/enc/test_gb18030.rb.JRuby PR #10121 needs a released JCodings version containing this fix before its MRI CI matrix can pass.