Compare commits

...
8 Commits
Author SHA1 Message Date
Christoph M. Becker 9ebd7f36b1 Update version for PHP 7.3.3 2019-03-05 13:48:56 +00:00
Anatol Belski 3e7c52454f Fix test portability
(cherry picked from commit 040196972c)
2019-03-04 19:45:00 +01:00
Stanislav Malyshev b0a5e5835a Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #77630 - safer rename() procedure

(cherry picked from commit 609195e991)
2019-03-04 19:39:57 +01:00
Christoph M. Becker 4e1b2bcc59 Fix NEWS order 2019-03-04 13:50:44 +01:00
Christoph M. Becker 4490467c2e Update NEWS 2019-03-04 13:39:26 +01:00
Stanislav Malyshev 4e676c7b1c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #77586 - phar_tar_writeheaders_int() buffer overflow

(cherry picked from commit 6d60ed69a1)
2019-03-04 13:19:02 +01:00
Stanislav Malyshev e0a7e0670a Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
  Fix test error message
  Fix bug #77563 - Uninitialized read in exif_process_IFD_in_MAKERNOTE
  Fix bug #77540 - Invalid Read on exif_process_SOFn
  Fix integer overflows on 32-bits
  Fix #77431 SplFileInfo::__construct() accepts NUL bytes
  Fix bug #77396 - Null Pointer Dereference in phar_create_or_parse_filename

(cherry picked from commit e3f7c352dc)
2019-03-04 13:18:32 +01:00
Christoph M. Becker 08daf96c92 Update version for PHP 7.3.3RC1 2019-02-19 11:14:39 +00:00
18 changed files with 169 additions and 44 deletions

No files matched your search

+20 -6
View File
@@ -1,6 +1,6 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.3
07 Mar 2019, PHP 7.3.3
- Core:
. Fixed bug #77589 (Core dump using parse_ini_string with numeric sections).
@@ -13,16 +13,29 @@ PHP NEWS
property). (Nikita)
. Fixed bug #77530 (PHP crashes when parsing `(2)::class`). (Ekin)
. Fixed bug #77546 (iptcembed broken function). (gdegoulet)
. Fixed bug #77630 (rename() across the device may allow unwanted access
during processing). (Stas)
- COM:
. Fixed bug #77621 (Already defined constants are not properly reported).
(cmb)
. Fixed bug #77626 (Persistence confusion in php_com_import_typelib()). (cmb)
- EXIF:
. Fixed bug #77509 (Uninitialized read in exif_process_IFD_in_TIFF). (Stas)
. Fixed bug #77540 (Invalid Read on exif_process_SOFn). (Stas)
. Fixed bug #77563 (Uninitialized read in exif_process_IFD_in_MAKERNOTE). (Stas)
. Fixed bug #77659 (Uninitialized read in exif_process_IFD_in_MAKERNOTE). (Stas)
- Mbstring:
. Fixed bug #77514 (mb_ereg_replace() with trailing backslash adds null byte).
(Nikita)
- MySQL
. Disabled LOCAL INFILE by default, can be enabled using php.ini directive
mysqli.allow_local_infile for mysqli, or PDO::MYSQL_ATTR_LOCAL_INFILE
attribute for pdo_mysql. (Darek Slusarczyk)
- OpenSSL:
. Fixed bug #77390 (feof might hang on TLS streams in case of fragmented TLS
records). (Abyl Valg, Jakub Zelenka)
@@ -31,12 +44,18 @@ PHP NEWS
. Support Oracle Database tracing attributes ACTION, MODULE,
CLIENT_INFO, and CLIENT_IDENTIFIER. (Cameron Porter)
- PHAR:
. Fixed bug #77396 (Null Pointer Dereference in phar_create_or_parse_filename).
(bishop)
. Fixed bug #77586 (phar_tar_writeheaders_int() buffer overflow). (bishop)
- phpdbg:
. Fixed bug #76596 (phpdbg support for display_errors=stderr). (kabel)
- SPL:
. Fixed bug #51068 (DirectoryIterator glob:// don't support current path
relative queries). (Ahmed Abdou)
. Fixed bug #77431 (openFile() silently truncates after a null byte). (cmb)
- Standard:
. Fixed bug #77552 (Unintialized php_stream_statbuf in stat functions).
@@ -44,11 +63,6 @@ PHP NEWS
. Fixed bug #77612 (setcookie() sets incorrect SameSite header if all of its
options filled). (Nikita)
- MySQL
. Disabled LOCAL INFILE by default, can be enabled using php.ini directive
mysqli.allow_local_infile for mysqli, or PDO::MYSQL_ATTR_LOCAL_INFILE
attribute for pdo_mysql. (Darek Slusarczyk)
07 Feb 2019, PHP 7.3.2
- Core:
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef ZEND_H
#define ZEND_H
#define ZEND_VERSION "3.3.3-dev"
#define ZEND_VERSION "3.3.3"
#define ZEND_ENGINE_3
+1 -1
View File
@@ -108,7 +108,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=3
PHP_RELEASE_VERSION=3
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`
+17 -10
View File
@@ -3125,7 +3125,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
break;
}
if (maker_note->offset >= value_len) {
if (value_len < 2 || maker_note->offset >= value_len - 1) {
/* Do not go past the value end */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X offset 0x%04X", value_len, maker_note->offset);
return FALSE;
@@ -3180,6 +3180,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
#endif
default:
case MN_OFFSET_NORMAL:
data_len = value_len;
break;
}
@@ -3903,7 +3904,7 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
return FALSE;
marker = c;
length = php_jpg_get16(data+pos);
if (pos+length>=ImageInfo->Thumbnail.size) {
if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) {
return FALSE;
}
#ifdef EXIF_DEBUG
@@ -3924,6 +3925,10 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
case M_SOF14:
case M_SOF15:
/* handle SOFn block */
if (length < 8 || ImageInfo->Thumbnail.size - 8 < pos) {
/* exif_process_SOFn needs 8 bytes */
return FALSE;
}
exif_process_SOFn(data+pos, marker, &sof_info);
ImageInfo->Thumbnail.height = sof_info.height;
ImageInfo->Thumbnail.width = sof_info.width;
@@ -3961,10 +3966,10 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
tag_table_type tag_table = exif_get_tag_table(section_index);
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
return FALSE;
}
return FALSE;
}
if (ImageInfo->FileSize >= dir_offset+2) {
if (ImageInfo->FileSize >= 2 && ImageInfo->FileSize - 2 >= dir_offset) {
sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL);
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, 2);
@@ -3972,8 +3977,8 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
php_stream_seek(ImageInfo->infile, dir_offset, SEEK_SET); /* we do not know the order of sections */
php_stream_read(ImageInfo->infile, (char*)ImageInfo->file.list[sn].data, 2);
num_entries = php_ifd_get16u(ImageInfo->file.list[sn].data, ImageInfo->motorola_intel);
dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
if (ImageInfo->FileSize >= dir_offset+dir_size) {
dir_size = 2/*num dir entries*/ +12/*length of entry*/*(size_t)num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
if (ImageInfo->FileSize >= dir_size && ImageInfo->FileSize - dir_size >= dir_offset) {
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X), IFD entries(%d)", ImageInfo->FileSize, dir_offset+2, dir_size-2, num_entries);
#endif
@@ -4056,9 +4061,9 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
}
}
}
if (ImageInfo->FileSize >= dir_offset + ImageInfo->file.list[sn].size) {
if (ImageInfo->FileSize >= ImageInfo->file.list[sn].size && ImageInfo->FileSize - ImageInfo->file.list[sn].size >= dir_offset) {
if (ifd_size > dir_size) {
if (dir_offset + ifd_size > ImageInfo->FileSize) {
if (ImageInfo->FileSize < ifd_size || dir_offset > ImageInfo->FileSize - ifd_size) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size);
return FALSE;
}
@@ -4655,7 +4660,9 @@ PHP_FUNCTION(exif_thumbnail)
ZVAL_STRINGL(return_value, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size);
if (arg_c >= 3) {
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(&ImageInfo);
if (!exif_scan_thumbnail(&ImageInfo)) {
ImageInfo.Thumbnail.width = ImageInfo.Thumbnail.height = 0;
}
}
zval_ptr_dtor(z_width);
zval_ptr_dtor(z_height);
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug 77540 (Invalid Read on exif_process_SOFn)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$width = $height = 42;
$s = exif_thumbnail(__DIR__."/bug77540.jpg", $width, $height);
echo "Width ".$width."\n";
echo "Height ".$height."\n";
?>
DONE
--EXPECTF--
Width 0
Height 0
DONE
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug 77563 (Uninitialized read in exif_process_IFD_in_MAKERNOTE)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$s = exif_thumbnail(__DIR__."/bug77563.jpg");
?>
DONE
--EXPECTF--
Warning: exif_thumbnail(bug77563.jpg): IFD data too short: 0x0009 offset 0x0008 in %s%ebug77563.php on line %d
Warning: exif_thumbnail(bug77563.jpg): File structure corrupted in %s%ebug77563.php on line %d
Warning: exif_thumbnail(bug77563.jpg): Invalid JPEG file in %s%ebug77563.php on line %d
DONE
+3
View File
@@ -1403,6 +1403,9 @@ int phar_create_or_parse_filename(char *fname, size_t fname_len, char *alias, si
/* set up our manifest */
mydata = ecalloc(1, sizeof(phar_archive_data));
mydata->fname = expand_filepath(fname, NULL);
if (mydata->fname == NULL) {
return FAILURE;
}
fname_len = strlen(mydata->fname);
#ifdef PHP_WIN32
phar_unixify_path_separators(mydata->fname, fname_len);
+6 -1
View File
@@ -764,7 +764,12 @@ static int phar_tar_writeheaders_int(phar_entry_info *entry, void *argument) /*
header.typeflag = entry->tar_type;
if (entry->link) {
strncpy(header.linkname, entry->link, strlen(entry->link));
if (strlcpy(header.linkname, entry->link, sizeof(header.linkname)) >= sizeof(header.linkname)) {
if (fp->error) {
spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, link \"%s\" is too long for format", entry->phar->fname, entry->link);
}
return ZEND_HASH_APPLY_STOP;
}
}
strncpy(header.magic, "ustar", sizeof("ustar")-1);
+3 -2
View File
@@ -13,5 +13,6 @@ DONE
<?php
@unlink(__DIR__."/bug71488.test");
?>
--EXPECT--
DONE
--EXPECTF--
Fatal error: Uncaught BadMethodCallException: tar-based phar "%s/bug71488.test" cannot be created, link "%s" is too long for format in %sbug71488.php:%d
Stack trace:%A
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #77396 Relative filename exceeding maximum path length causes null pointer dereference.
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--FILE--
<?php
$path = '../' . str_repeat("x", PHP_MAXPATHLEN) . '.tar';
$phar = new PharData($path);
?>
--EXPECTF--
Fatal error: Uncaught UnexpectedValueException: Phar creation or opening failed in %s%ebug77396.php:%d
Stack trace:
#0 %s%ebug77396.php(%d): PharData->__construct(%s)
#1 {main}
thrown in %s%ebug77396.php on line %d
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #77586 Symbolic link names in tar-formatted phar must be less than 100 bytes.
--SKIPIF--
<?php if (!extension_loaded("phar") || true /* blocked by bug 65332 */) die("skip"); ?>
--FILE--
<?php
$dir = __DIR__."/bug77586";
$phar = new PharData($dir . "/bug77586.tar");
$phar->buildFromDirectory($dir . "/files");
?>
--CLEAN--
<?php
$dir = __DIR__."/bug77586";
unlink($dir . "/bug77586.tar");
?>
--EXPECTF--
Fatal error: Uncaught PharException: tar-based phar "%s/bug77586.tar" cannot be created, link "%s" is too long for format %s
Stack trace:
#0 %s/bug77586.php(%d): PharData->buildFromDirectory('%s')
#1 {main}
thrown in %s/bug77586.php %s on line %d
+1 -1
View File
@@ -1133,7 +1133,7 @@ SPL_METHOD(SplFileInfo, __construct)
char *path;
size_t len;
if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &path, &len) == FAILURE) {
if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "p", &path, &len) == FAILURE) {
return;
}
+9
View File
@@ -0,0 +1,9 @@
--TEST--
Bug #77431 (SplFileInfo::__construct() accepts NUL bytes)
--FILE--
<?php
new SplFileInfo("bad\0good");
?>
--EXPECTF--
Fatal error: Uncaught TypeError: SplFileInfo::__construct() expects parameter 1 to be a valid path, string given in %s:%d
Stack trace:%A
+2 -2
View File
@@ -3,6 +3,6 @@
#define PHP_MAJOR_VERSION 7
#define PHP_MINOR_VERSION 3
#define PHP_RELEASE_VERSION 3
#define PHP_EXTRA_VERSION "-dev"
#define PHP_VERSION "7.3.3-dev"
#define PHP_EXTRA_VERSION ""
#define PHP_VERSION "7.3.3"
#define PHP_VERSION_ID 70303
+37 -20
View File
@@ -1198,34 +1198,51 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
# ifdef EXDEV
if (errno == EXDEV) {
zend_stat_t sb;
# if !defined(ZTS) && !defined(TSRM_WIN32)
/* not sure what to do in ZTS case, umask is not thread-safe */
int oldmask = umask(077);
# endif
int success = 0;
if (php_copy_file(url_from, url_to) == SUCCESS) {
if (VCWD_STAT(url_from, &sb) == 0) {
# ifndef TSRM_WIN32
if (VCWD_CHMOD(url_to, sb.st_mode)) {
if (errno == EPERM) {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
VCWD_UNLINK(url_from);
return 1;
}
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
return 0;
}
success = 1;
# if !defined(TSRM_WIN32)
/*
* Try to set user and permission info on the target.
* If we're not root, then some of these may fail.
* We try chown first, to set proper group info, relying
* on the system environment to have proper umask to not allow
* access to the file in the meantime.
*/
if (VCWD_CHOWN(url_to, sb.st_uid, sb.st_gid)) {
if (errno == EPERM) {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
VCWD_UNLINK(url_from);
return 1;
}
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
return 0;
if (errno != EPERM) {
success = 0;
}
}
if (success) {
if (VCWD_CHMOD(url_to, sb.st_mode)) {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
if (errno != EPERM) {
success = 0;
}
}
}
# endif
VCWD_UNLINK(url_from);
return 1;
if (success) {
VCWD_UNLINK(url_from);
}
} else {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
}
} else {
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
}
php_error_docref2(NULL, url_from, url_to, E_WARNING, "%s", strerror(errno));
return 0;
# if !defined(ZTS) && !defined(TSRM_WIN32)
umask(oldmask);
# endif
return success;
}
# endif
#endif