Skip to content

ext/standard: Bound XBM dimensions - #335

Closed
iliaal wants to merge 1 commit into
PHP-8.4from
fix/aph-r6oy
Closed

iliaal wants to merge 1 commit into
PHP-8.4from
fix/aph-r6oy

Conversation

@iliaal

@iliaal iliaal commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Reject malformed and overflowing XBM dimensions before image allocation. The regression tests cover invalid dimensions through both image APIs.

@iliaal
iliaal changed the base branch from master to PHP-8.4 September 24, 2026 13:03
XBM width and height were read with sscanf("%d"), whose behaviour on
overflow is undefined; glibc wraps 4294967298 to 2, so getimagesize()
reported a width of 2 and the bundled GD decoded a 2-pixel image, while
negative values came back as huge unsigned sizes. Parse the value with
strtol() and accept only 1 to INT_MAX in both readers, and bound the
bundled GD row byte count times height by INT_MAX.
@iliaal

iliaal commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Promoted upstream as php#25293.

@iliaal iliaal closed this Nov 7, 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.

1 participant