[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6

From: Date: Mon, 28 Sep 2026 23:27:20 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141653@lists.php.net to get a copy of this message
Author: Daniel Scherzer (DanielEScherzer) Date: 2026-09-28T16:25:51-07:00 Commit: https://github.com/php/php-src/commit/a423c90e454421c65ccb04bee5bb86cd74495d6b Raw diff: https://github.com/php/php-src/commit/a423c90e454421c65ccb04bee5bb86cd74495d6b.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: NEWS ext/gd: fix undefined behavior with GD2 images with INT_MAX-sized chunks Changed paths: A ext/gd/tests/createfromstring-overflow.phpt Diff: diff --git a/ext/gd/tests/createfromstring-overflow.phpt b/ext/gd/tests/createfromstring-overflow.phpt new file mode 100644 index 000000000000..e79f380424ec --- /dev/null +++ b/ext/gd/tests/createfromstring-overflow.phpt @@ -0,0 +1,42 @@ +--TEST-- +imagecreatefromstring overflow with compressed chunk of size INT_MAX +--EXTENSIONS-- +gd +--FILE-- +<?php + +// Documentation available at https://libgd.github.io/manuals/2.3.3/files/gd_gd2-c.html +$fileHeaderParts = [ + "signature" => "gd2\x00", + "version" => "\x00\x02", + "width" => "\x00\x01", + "height" => "\x00\x01", + "chunk_size" => "\x00\x40", + "format" => "\x00\x04", // compressed truecolor image data + "x_chunk_count" => "\x00\x01", + "y_chunk_count" => "\x00\x01", +]; +$fileHeader = implode("", $fileHeaderParts); + +$chunkHeaderParts = [ + "offset" => "\x00\x00\x00\x20", + "size" =>"\x7F\xFF\xFF\xFF", // INT_MAX +]; +$chunkHeader = implode("", $chunkHeaderParts); + +$trueColorHeaderParts = [ + "truecolor" => "\x01", + "transparent" => "\x00\x00\x00\x00", +]; +$trueColorHeader = implode("", $trueColorHeaderParts); + +$source = $fileHeader . $chunkHeader . $trueColorHeader; +$img = imagecreatefromstring($source); +var_dump($img); + +?> +--EXPECTF-- +Warning: imagecreatefromstring(): Passed data is not in "GD2" format in %s on line %d + +Warning: imagecreatefromstring(): Couldn't create GD Image Stream out of Data in %s on line %d +bool(false)

« previous php.cvs (#141653) next »