[php-src] Issue #20602: integer overflow in imagescale

From: Date: Thu, 27 Nov 2025 15:03:46 +0000
Subject: [php-src] Issue #20602: integer overflow in imagescale
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251316@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/20602 Author: chongwick ### Description The following code: ```php <?php $v_17401 = 2; $v_3914 = 1; $v_3915 = imagecreatetruecolor($v_17401,$v_3914,); $v_3917 = 1; $v_3918 = -($v_3917); $v_17364 = 9223372036854775807; $v_17415 = 1; $v_3922 = imagescale($v_3915,$v_3918,$v_17364,$v_17415,); ``` Resulted in this output: ``` /home/w023dtc/nightly_php/php-src/ext/gd/gd.c:3937:18: runtime error: signed integer overflow: 9223372036854775807 * 2 cannot be represented in type 'long' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/w023dtc/nightly_php/php-src/ext/gd/gd.c:3937:18 ``` But I expected this output instead: ``` ``` ### PHP Version ```plain nightly ``` ### Operating System _No response_

« previous php.bugs (#251316) next »