Skip to content

use long for EmfPlusDrawDriverString glyph byte length#1098

Merged
pjfanning merged 1 commit into
apache:trunkfrom
metsw24-max:emfplus-driverstring-glyph-overflow
Jun 1, 2026
Merged

use long for EmfPlusDrawDriverString glyph byte length#1098
pjfanning merged 1 commit into
apache:trunkfrom
metsw24-max:emfplus-driverstring-glyph-overflow

Conversation

@metsw24-max
Copy link
Copy Markdown
Contributor

EmfPlusDrawDriverString.init reads a 32-bit glyph count from untrusted EMF+ bytes and allocates glyphCount2 bytes. The product is computed in int, so a count of 0x40000000 wraps negative and slips past the MAX_OBJECT_SIZE cap in IOUtils.toByteArray, surfacing a raw IllegalStateException instead of a RecordFormatException. Using glyphCount2L routes through the long toByteArray overload so the cap fires first.

Copy link
Copy Markdown
Member

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

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

lgtm

@pjfanning pjfanning merged commit e5d0cad into apache:trunk Jun 1, 2026
1 check passed
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