Compare commits

...
7 Commits
9 changed files with 83 additions and 8 deletions

No files matched your search

+7 -2
View File
@@ -1,9 +1,14 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2015, PHP 5.5.30
** PHP 5.5 is in security-only mode , please do not commit to this branch **
01 Oct 2015, PHP 5.5.30
- Phar:
. Fixed bug #69720 (Null pointer dereference in phar_get_fp_offset()). (Stas)
. FIxed bug #70433 (Uninitialized pointer in phar_make_dirstream when zip
entry filename is "/"). (Stas)
03 Sep 2015, PHP 5.5.29
- Core:
+1 -1
View File
@@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=5
PHP_RELEASE_VERSION=30
PHP_EXTRA_VERSION="-dev"
PHP_EXTRA_VERSION=""
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
Binary file not shown.
+40
View File
@@ -0,0 +1,40 @@
--TEST--
Phar - bug #69720 - Null pointer dereference in phar_get_fp_offset()
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--FILE--
<?php
try {
// open an existing phar
$p = new Phar(__DIR__."/bug69720.phar",0);
// Phar extends SPL's DirectoryIterator class
echo $p->getMetadata();
foreach (new RecursiveIteratorIterator($p) as $file) {
// $file is a PharFileInfo class, and inherits from SplFileInfo
$temp="";
$temp= $file->getFileName() . "\n";
$temp.=file_get_contents($file->getPathName()) . "\n"; // display contents
var_dump($file->getMetadata());
}
}
catch (Exception $e) {
echo 'Could not open Phar: ', $e;
}
?>
--EXPECTF--
MY_METADATA_NULL
Warning: file_get_contents(phar:///%s): failed to open stream: phar error: "test.php" is not a file in phar "%s.phar" in %s.php on line %d
array(1) {
["whatever"]=>
int(123)
}
object(DateTime)#2 (3) {
["date"]=>
string(26) "2000-01-01 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
+23
View File
@@ -0,0 +1,23 @@
--TEST--
Phar - bug #70433 - Uninitialized pointer in phar_make_dirstream when zip entry filename is "/"
--SKIPIF--
<?php if (!extension_loaded("phar") || !extension_loaded("zlib")) die("skip"); ?>
--FILE--
<?php
$phar = new PharData(__DIR__."/bug70433.zip");
var_dump($phar);
$meta = $phar->getMetadata();
var_dump($meta);
?>
DONE
--EXPECTF--
object(PharData)#1 (3) {
["pathName":"SplFileInfo":private]=>
string(0) ""
["glob":"DirectoryIterator":private]=>
bool(false)
["subPathName":"RecursiveDirectoryIterator":private]=>
string(0) ""
}
NULL
DONE
BIN
View File
Binary file not shown.
+7 -2
View File
@@ -494,7 +494,12 @@ really_get_entry:
(*ret)->is_tar = entry->is_tar;
(*ret)->fp = phar_get_efp(entry, 1 TSRMLS_CC);
if (entry->link) {
(*ret)->zero = phar_get_fp_offset(phar_get_link_source(entry TSRMLS_CC) TSRMLS_CC);
phar_entry_info *link = phar_get_link_source(entry TSRMLS_CC);
if(!link) {
efree(*ret);
return FAILURE;
}
(*ret)->zero = phar_get_fp_offset(link TSRMLS_CC);
} else {
(*ret)->zero = phar_get_fp_offset(entry TSRMLS_CC);
}
@@ -1972,7 +1977,7 @@ void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int filename
while ((s = zend_memrchr(filename, '/', filename_len))) {
filename_len = s - filename;
if (FAILURE == zend_hash_add_empty_element(&phar->virtual_dirs, filename, filename_len)) {
if (!filename_len || FAILURE == zend_hash_add_empty_element(&phar->virtual_dirs, filename, filename_len)) {
break;
}
}
+3 -1
View File
@@ -396,7 +396,9 @@ foundit:
if (entry.filename[entry.filename_len - 1] == '/') {
entry.is_dir = 1;
entry.filename_len--;
if(entry.filename_len > 1) {
entry.filename_len--;
}
entry.flags |= PHAR_ENT_PERM_DEF_DIR;
} else {
entry.is_dir = 0;
+2 -2
View File
@@ -3,6 +3,6 @@
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 5
#define PHP_RELEASE_VERSION 30
#define PHP_EXTRA_VERSION "-dev"
#define PHP_VERSION "5.5.30-dev"
#define PHP_EXTRA_VERSION ""
#define PHP_VERSION "5.5.30"
#define PHP_VERSION_ID 50530