Skip to content

Fix imagecreatefromstring() continuing after the too long ValueError - #25411

Closed
lacatoire wants to merge 1 commit into
php:PHP-8.5from
lacatoire:fix/imagecreatefromstring-too-long-return-85
Closed

lacatoire wants to merge 1 commit into
php:PHP-8.5from
lacatoire:fix/imagecreatefromstring-too-long-return-85

Conversation

@lacatoire

Copy link
Copy Markdown
Member

imagecreatefromstring() threw the ValueError for a string longer than INT_MAX but did not return, so it went on decoding the data with the exception pending. Return after throwing.

To reproduce:

ini_set('memory_limit', '-1');
try { imagecreatefromstring(str_repeat("x", 2147483648)); } catch (ValueError $e) { echo $e->getMessage(); }

Before: an extra Warning: Data is not in a recognized format. After: only the ValueError.

@devnexen devnexen closed this in 794fea4 Nov 13, 2026
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