[php-src] Issue #20732: undefined behavior in phar

[email protected] (chongwick)
Newsgroups php.bugs
Message-ID <zGHhgxMlIRCbcZA6tgK0zuHMyiAmPz3S36tlH6b48NM@main.internal.php.net>
Issue: https://github.com/php/php-src/issues/20732
Author: chongwick

### Description

The following code:

```php
<?php
$v_3963 = $v_3963;
$v_3964 = json_decode($v_3963,);
$v_3965 = JSON_PRETTY_PRINT;
$v_3966 = json_encode($v_3964,$v_3965,);
$v_3966 = json_decode($v_3966,);
$v_13995 = chdir($v_3966,);
try{
$v_13510 = DIRECTORY_SEPARATOR;
$v_13999 = Phar::LoadPhar($v_13510,$v_3964,);
$v_14000 = 'OK\n';
}
catch (PharException $e){
$v_13996 = $e->getMessage();
}
```

Resulted in this output:
```
/home/w023dtc/nightly_php/php-src/ext/phar/phar.c:1723:70: runtime error: index 18446744073709551615 out of bounds for type 'char [1043]'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/w023dtc/nightly_php/php-src/ext/phar/phar.c:1723:70
```




### PHP Version

```plain
nightly
```

### Operating System

ubuntu 22.04
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.