mirror of
https://github.com/php/php-src.git
synced 2024-12-12 11:23:53 +08:00
Fix bug #71391: NULL Pointer Dereference in phar_tar_setupmetadata()
This commit is contained in:
parent
285cd3417f
commit
1c1b8b6998
@ -880,6 +880,9 @@ static int phar_tar_setupmetadata(void *pDest, void *argument TSRMLS_DC) /* {{{
|
||||
|
||||
if (entry->filename_len >= sizeof(".phar/.metadata") && !memcmp(entry->filename, ".phar/.metadata", sizeof(".phar/.metadata")-1)) {
|
||||
if (entry->filename_len == sizeof(".phar/.metadata.bin")-1 && !memcmp(entry->filename, ".phar/.metadata.bin", sizeof(".phar/.metadata.bin")-1)) {
|
||||
if (entry->phar->metadata == NULL) {
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
return phar_tar_setmetadata(entry->phar->metadata, entry, error TSRMLS_CC);
|
||||
}
|
||||
/* search for the file this metadata entry references */
|
||||
|
18
ext/phar/tests/bug71391.phpt
Normal file
18
ext/phar/tests/bug71391.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Phar: bug #71391: NULL Pointer Dereference in phar_tar_setupmetadata()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
// duplicate since the tar will change
|
||||
copy(__DIR__."/bug71391.tar", __DIR__."/bug71391.test.tar");
|
||||
$p = new PharData(__DIR__."/bug71391.test.tar");
|
||||
$p->delMetaData();
|
||||
?>
|
||||
DONE
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__."/bug71391.test.tar");
|
||||
?>
|
||||
--EXPECT--
|
||||
DONE
|
BIN
ext/phar/tests/bug71391.tar
Normal file
BIN
ext/phar/tests/bug71391.tar
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user