Skip to content

Fix implicit type‑conversion precision issues in equalsIgnoreCase#1010

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

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.
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