[php-src] Issue #20620: undefined behavior in bzcompress
| From: | chongwick | Date: | Sat, 29 Nov 2025 21:10:51 +0000 |
| Subject: | [php-src] Issue #20620: undefined behavior in bzcompress | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251333@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20620
Author: chongwick
### Description
The following code:
```php
<?php
$v_8786 = '.';
$v_8787 = 1;
$v_8788 = 1;
$v_8789 = 1;
$v_8790 = bzcompress($v_8787,$v_8788,$v_8789,);
$v_7209 = 'B';
$v_7210 = 65537;
$v_7211 = str_repeat($v_7209,$v_7210,);
$v_7212 = 1;
$v_7213 = 'B';
$v_7214 = 65537;
$v_7215 = str_repeat($v_7213,$v_7214,);
$v_7216 = chunk_split($v_7211,$v_7212,$v_7215,);
$v_8792 = bzcompress($v_7216,);
$v_8795 = bzcompress($v_8786,$v_8788,$v_8792,);
```
Resulted in this output:
```
/home/w023dtc/nightly_php/php-src/ext/bz2/bz2.c:480:13: runtime error: 4.33812e+09 is outside the
range of representable values of type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
/home/w023dtc/nightly_php/php-src/ext/bz2/bz2.c:480:13
```
```
USE_ZEND_ALLOC=0
```
### PHP Version
```plain
nightly
```
### Operating System
ubuntu 22.04