Skip to content

fix out-of-bounds read in HexBin for byte 0xff#33

Closed
aizu-m wants to merge 1 commit into
apache:trunkfrom
aizu-m:hexbin-0xff-bounds
Closed

fix out-of-bounds read in HexBin for byte 0xff#33
aizu-m wants to merge 1 commit into
apache:trunkfrom
aizu-m:hexbin-0xff-bounds

Conversation

@aizu-m
Copy link
Copy Markdown

@aizu-m aizu-m commented Jun 2, 2026

isHex looks up hexNumberTable[octet & 0xFF] so the index can be 255, but the table is sized 255 (max index 254), so a 0xFF byte (a U+00FF char in xsd:hexBinary text) makes decode throw ArrayIndexOutOfBoundsException instead of returning null for non-hex input like it does for every other invalid byte. Sizing the table to 256 keeps the check inside the lookup table.

@pjfanning
Copy link
Copy Markdown
Member

pjfanning commented Jun 2, 2026

I raised https://issues.apache.org/jira/browse/XMLBEANS-665

This method is an internal method. Please don't use it as a hex utility. Find a better Java method.

@pjfanning
Copy link
Copy Markdown
Member

thanks - d4e56ea merged

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