Skip to content

Guard case mapping and multibyte case folding - #73

Merged
headius merged 1 commit into
jruby:masterfrom
headius:codex/case-map-bounds-2026
Nov 19, 2026
Merged

headius merged 1 commit into
jruby:masterfrom
headius:codex/case-map-bounds-2026

Conversation

@headius

@headius headius commented Nov 19, 2026

Copy link
Copy Markdown
Member

CRuby's fixes for ruby/ruby#20005 and the Emacs-Mule case-folding change in ruby/ruby#20002 correspond to code in JCodings.

This change:

  • Leaves room for sharp-s expansion before processing a character in the 14 affected single-byte encodings.
  • Uses a multibyte character's nominal length when case-folding across a logical end boundary, while limiting reads to the backing byte array.
  • Adds bounded regressions for short output buffers and split/truncated Emacs-Mule input.

The CRuby rb_str_casemap overflow guard in ruby/ruby#20006 has no equivalent accumulator in JCodings and is not included.

Tests on Java 21:

JAVA_HOME=/home/happier/.local/share/jruby-dev/jdk-21 PATH=/home/happier/.local/share/jruby-dev/jdk-21/bin:$PATH /home/happier/workspace/jruby/worktrees/ruby-regexp-security-tests/mvnw -Dmaven.repo.local=/home/happier/workspace/jruby/.state/ruby-regexp-security-tests/maven/repository -Dtest=TestCaseMap,TestEmacsMule test

Passed: 10 tests, 0 failures, 0 errors.

@headius
headius marked this pull request as ready for review November 19, 2026 22:11

@headius headius left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@headius headius added this to the 1.0.66 milestone Nov 19, 2026
@headius
headius merged commit 8798b86 into jruby:master Nov 19, 2026
7 checks passed
@headius
headius deleted the codex/case-map-bounds-2026 branch November 19, 2026 22:17
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