[php-src] Issue #15613: Signed integer overflow in ext/standard/pack.c
| From: | YuanchengJiang | Date: | Wed, 28 Aug 2024 06:15:45 +0000 |
| Subject: | [php-src] Issue #15613: Signed integer overflow in ext/standard/pack.c | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247617@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15613
Author: YuanchengJiang
### Description
The following code:
```php
<?php
unpack('h2147483647', str_repeat('X', 2**31 + 10));
?>
```
Resulted in this output:
```
/php-src/ext/standard/pack.c:981:36: runtime error: signed integer overflow: 1073741824 * 2 cannot
be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/standard/pack.c:981:36 in
```
### PHP Version
PHP 8.4.0-dev
### Operating System
ubuntu 22.04