Skip to content

Fix implicit type‑conversion precision issues in equalsIgnoreCase#1010

Closed
Chenjp wants to merge 1 commit into
apache:mainfrom
Chenjp:bc_fix_eq_cast
Closed

Fix implicit type‑conversion precision issues in equalsIgnoreCase#1010
Chenjp wants to merge 1 commit into
apache:mainfrom
Chenjp:bc_fix_eq_cast

Conversation

@Chenjp
Copy link
Copy Markdown
Contributor

@Chenjp Chenjp commented May 21, 2026

See testcase,

        // bc ByteChunk bytes: Hello
        Assert.assertTrue(bc.equalsIgnoreCase("heLLo"));
        Assert.assertFalse(bc.equalsIgnoreCase("\u8a48\u8a65\u8a6c\u8a6c\u8a6f"));

Ascii.toLower(c) implicitly assume c<=0xff.
It is hard to exploit with this weakness. Now add an explicit check to improve robustness.

See testcase.
Ascii.toLower(c) implicitly assume c<=0xff.
Now add an explicit check.
markt-asf added a commit that referenced this pull request May 22, 2026
Update documentation to expand supported range from 0x00-0x7F to
0x00-0xFF where appropriate.
Based on PR #1010 by Chenjp
markt-asf added a commit that referenced this pull request May 22, 2026
Update documentation to expand supported range from 0x00-0x7F to
0x00-0xFF where appropriate.
Based on PR #1010 by Chenjp
markt-asf added a commit that referenced this pull request May 22, 2026
Update documentation to expand supported range from 0x00-0x7F to
0x00-0xFF where appropriate.
Based on PR #1010 by Chenjp
markt-asf added a commit that referenced this pull request May 22, 2026
Update documentation to expand supported range from 0x00-0x7F to
0x00-0xFF where appropriate.
Based on PR #1010 by Chenjp
@markt-asf
Copy link
Copy Markdown
Contributor

Thanks for the PR. I've fixed this and a handful of similar issues.

@markt-asf markt-asf closed this May 22, 2026
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.

2 participants