Skip to content

stb_truetype: fix integer overflow in bitmap/SDF allocation#1867

Open
choongng wants to merge 1 commit into
nothings:masterfrom
choongng:fix-integer-overflow-sdf-bitmap
Open

stb_truetype: fix integer overflow in bitmap/SDF allocation#1867
choongng wants to merge 1 commit into
nothings:masterfrom
choongng:fix-integer-overflow-sdf-bitmap

Conversation

@choongng

Copy link
Copy Markdown

Add overflow checks before allocating bitmap buffers in stbtt_GetGlyphBitmapSubpixel and stbtt_GetGlyphSDF.

When computing allocation size as w * h, the multiplication can overflow INT_MAX causing a small allocation followed by massive out-of-bounds writes during rendering.

Return NULL when overflow would occur, consistent with existing allocation failure handling.

Add overflow checks before allocating bitmap buffers in
stbtt_GetGlyphBitmapSubpixel and stbtt_GetGlyphSDF.

When computing allocation size as w * h, the multiplication can
overflow INT_MAX causing a small allocation followed by massive
out-of-bounds writes during rendering.

Return NULL when overflow would occur, consistent with existing
allocation failure handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants