mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix bug #69958 - Segfault in Phar::convertToData on invalid file
This commit is contained in:
parent
5df893ce3c
commit
00f177a5ed
3 changed files with 17 additions and 1 deletions
|
@ -2296,7 +2296,9 @@ no_copy:
|
|||
zend_hash_destroy(&(phar->manifest));
|
||||
zend_hash_destroy(&(phar->mounted_dirs));
|
||||
zend_hash_destroy(&(phar->virtual_dirs));
|
||||
php_stream_close(phar->fp);
|
||||
if (phar->fp) {
|
||||
php_stream_close(phar->fp);
|
||||
}
|
||||
efree(phar->fname);
|
||||
efree(phar);
|
||||
return NULL;
|
||||
|
|
14
ext/phar/tests/bug69958.phpt
Normal file
14
ext/phar/tests/bug69958.phpt
Normal file
|
@ -0,0 +1,14 @@
|
|||
--TEST--
|
||||
Phar: bug #69958: Segfault in Phar::convertToData on invalid file
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$tarphar = new PharData(__DIR__.'/bug69958.tar');
|
||||
$phar = $tarphar->convertToData(Phar::TAR);
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'BadMethodCallException' with message 'phar "%s/bug69958.tar" exists and must be unlinked prior to conversion' in %s/bug69958.php:%d
|
||||
Stack trace:
|
||||
#0 %s/bug69958.php(%d): PharData->convertToData(%d)
|
||||
#1 {main}
|
||||
thrown in %s/bug69958.php on line %d
|
BIN
ext/phar/tests/bug69958.tar
Normal file
BIN
ext/phar/tests/bug69958.tar
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue