[php-src] Issue #20622: integer overflow in ImageString
| From: | chongwick | Date: | Sat, 29 Nov 2025 21:57:13 +0000 |
| Subject: | [php-src] Issue #20622: integer overflow in ImageString | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251334@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20622
Author: chongwick
### Description
The following code:
```php
<?php
$im = imagecreate(100, 30);
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
imagestring($im, 5, 2147483647, 0, 'Hello world!', $textcolor);
```
Resulted in this output:
```
/home/w023dtc/nightly_php/php-src/ext/gd/gd.c:3020:7: runtime error: signed integer overflow:
2147483647 + 9 cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
/home/w023dtc/nightly_php/php-src/ext/gd/gd.c:3020:7
```
### PHP Version
```plain
nightly
```
### Operating System
ubuntu 22.04