Skip to content

Phar::LoadPhar undefined behavior when loading directory #20732

@chongwick

Description

@chongwick

Description

The following code:

<?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

nightly

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions