[php-src] Issue #20620: undefined behavior in bzcompress
[email protected] (chongwick)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <ubZSLXa9QsGP7s8qxhs5jf2uh2oFVdxqO63TAPoJLzo@main.internal.php.net> |
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