mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-10 18:50:50 +00:00
Compare commits
31
Commits
php-7.2.15
...
php-7.1.30
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8359932369 | ||
|
|
c34895e837 | ||
|
|
73ff4193be | ||
|
|
16e037bd46 | ||
|
|
7cf7148a8f | ||
|
|
ed6dee9a19 | ||
|
|
f80ad18afa | ||
|
|
6c631ccfef | ||
|
|
588db7cecf | ||
|
|
731eeb8dec | ||
|
|
dc1cd3daf2 | ||
|
|
01a4de5c58 | ||
|
|
887a7b5714 | ||
|
|
c684d32fb8 | ||
|
|
f3aefc6d07 | ||
|
|
0ecac37c40 | ||
|
|
40fe50daf6 | ||
|
|
58c25bf679 | ||
|
|
66bd861fcd | ||
|
|
b6308f5b48 | ||
|
|
58c5df3d37 | ||
|
|
e3133e4db7 | ||
|
|
e0f5d62bd6 | ||
|
|
759e841b24 | ||
|
|
44f87fbf36 | ||
|
|
8ac6fee856 | ||
|
|
5f0e62a3e5 | ||
|
|
5e824a88d0 | ||
|
|
254a5914ad | ||
|
|
7f0ab7c20c | ||
|
|
65d81833bb |
No files matched your search
@@ -1,7 +1,61 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2019, PHP 7.1.27
|
||||
30 May 2019, PHP 7.1.30
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #77988 (heap-buffer-overflow on php_jpg_get16).
|
||||
(CVE-2019-11040) (Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #77973 (Uninitialized read in gdImageCreateFromXbm).
|
||||
(CVE-2019-11038) (cmb)
|
||||
|
||||
- Iconv:
|
||||
. Fixed bug #78069 (Out-of-bounds read in iconv.c:_php_iconv_mime_decode()
|
||||
due to integer overflow). (CVE-2019-11039). (maris dot adam)
|
||||
|
||||
- SQLite:
|
||||
. Fixed bug #77967 (Bypassing open_basedir restrictions via file uris). (Stas)
|
||||
|
||||
03 May 2019, PHP 7.1.29
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #77950 (Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG).
|
||||
(CVE-2019-11036) (Stas)
|
||||
|
||||
- Mail:
|
||||
. Fixed bug #77821 (Potential heap corruption in TSendMail()). (cmb)
|
||||
|
||||
04 Apr 2019, PHP 7.1.28
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #77753 (Heap-buffer-overflow in php_ifd_get32s). (CVE-2019-11034)
|
||||
(Stas)
|
||||
. Fixed bug #77831 (Heap-buffer-overflow in exif_iif_add_value).
|
||||
(CVE-2019-11035) (Stas)
|
||||
|
||||
- SQLite3:
|
||||
. Added sqlite3.defensive INI directive. (BohwaZ)
|
||||
|
||||
07 Mar 2019, PHP 7.1.27
|
||||
|
||||
- Core:
|
||||
. Fixed bug #77630 (rename() across the device may allow unwanted access during
|
||||
processing). (Stas)
|
||||
|
||||
- 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)
|
||||
|
||||
- PHAR:
|
||||
. Fixed bug #77396 (Null Pointer Dereference in phar_create_or_parse_filename).
|
||||
(bishop)
|
||||
. Fixed bug #77586 (phar_tar_writeheaders_int() buffer overflow). (bishop)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #77431 (openFile() silently truncates after a null byte). (cmb)
|
||||
|
||||
10 Jan 2019, PHP 7.1.26
|
||||
|
||||
|
||||
+65
-31
@@ -2212,45 +2212,79 @@ AC_DEFUN([PHP_SETUP_ICU],[
|
||||
PHP_ICU_DIR=DEFAULT
|
||||
fi
|
||||
|
||||
if test "$PHP_ICU_DIR" = "DEFAULT"; then
|
||||
dnl Try to find icu-config
|
||||
AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
|
||||
else
|
||||
ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
|
||||
AC_MSG_CHECKING([for location of ICU headers and libraries])
|
||||
found_icu=no
|
||||
|
||||
dnl First try to find pkg-config
|
||||
if test -z "$PKG_CONFIG"; then
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for location of ICU headers and libraries])
|
||||
dnl If pkg-config is found try using it
|
||||
if test "$PHP_ICU_DIR" = "DEFAULT" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists icu-uc icu-io icu-i18n; then
|
||||
if $PKG_CONFIG --atleast-version=40 icu-uc; then
|
||||
found_icu=yes
|
||||
icu_version_full=`$PKG_CONFIG --modversion icu-uc`
|
||||
ac_IFS=$IFS
|
||||
IFS="."
|
||||
set $icu_version_full
|
||||
IFS=$ac_IFS
|
||||
icu_version=`expr [$]1 \* 1000 + [$]2`
|
||||
AC_MSG_RESULT([found $icu_version_full])
|
||||
|
||||
dnl Trust icu-config to know better what the install prefix is..
|
||||
icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
|
||||
if test "$?" != "0" || test -z "$icu_install_prefix"; then
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
|
||||
else
|
||||
AC_MSG_RESULT([$icu_install_prefix])
|
||||
ICU_LIBS=`$PKG_CONFIG --libs icu-uc icu-io icu-i18n`
|
||||
ICU_INCS=`$PKG_CONFIG --cflags-only-I icu-uc icu-io icu-i18n`
|
||||
ICU_CXXFLAGS="-DU_USING_ICU_NAMESPACE=1"
|
||||
|
||||
dnl Check ICU version
|
||||
AC_MSG_CHECKING([for ICU 4.0 or greater])
|
||||
icu_version_full=`$ICU_CONFIG --version`
|
||||
ac_IFS=$IFS
|
||||
IFS="."
|
||||
set $icu_version_full
|
||||
IFS=$ac_IFS
|
||||
icu_version=`expr [$]1 \* 1000 + [$]2`
|
||||
AC_MSG_RESULT([found $icu_version_full])
|
||||
AC_MSG_RESULT([found $ICU_VERSION])
|
||||
|
||||
if test "$icu_version" -lt "4000"; then
|
||||
AC_MSG_ERROR([ICU version 4.0 or later is required])
|
||||
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
|
||||
PHP_EVAL_INCLINE($ICU_INCS)
|
||||
else
|
||||
AC_MSG_ERROR([ICU version 4.0 or later required.])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl If pkg-config fails for some reason, revert to the old method
|
||||
if test "$found_icu" = "no"; then
|
||||
if test "$PHP_ICU_DIR" = "DEFAULT"; then
|
||||
dnl Try to find icu-config
|
||||
AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
|
||||
else
|
||||
ICU_CONFIG="$PHP_ICU_DIR/bin/icu-config"
|
||||
fi
|
||||
|
||||
ICU_VERSION=$icu_version
|
||||
ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
|
||||
ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
|
||||
PHP_EVAL_INCLINE($ICU_INCS)
|
||||
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
|
||||
dnl Trust icu-config to know better what the install prefix is..
|
||||
icu_install_prefix=`$ICU_CONFIG --prefix 2> /dev/null`
|
||||
if test "$?" != "0" || test -z "$icu_install_prefix"; then
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_ERROR([Unable to detect ICU prefix or $ICU_CONFIG failed. Please verify ICU install prefix and make sure icu-config works.])
|
||||
else
|
||||
AC_MSG_RESULT([$icu_install_prefix])
|
||||
|
||||
ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
|
||||
ICU_CXXFLAGS="$ICU_CXXFLAGS -DU_USING_ICU_NAMESPACE=1"
|
||||
dnl Check ICU version
|
||||
AC_MSG_CHECKING([for ICU 4.0 or greater])
|
||||
icu_version_full=`$ICU_CONFIG --version`
|
||||
ac_IFS=$IFS
|
||||
IFS="."
|
||||
set $icu_version_full
|
||||
IFS=$ac_IFS
|
||||
icu_version=`expr [$]1 \* 1000 + [$]2`
|
||||
AC_MSG_RESULT([found $icu_version_full])
|
||||
|
||||
if test "$icu_version" -lt "4000"; then
|
||||
AC_MSG_ERROR([ICU version 4.0 or later is required])
|
||||
fi
|
||||
|
||||
ICU_VERSION=$icu_version
|
||||
ICU_INCS=`$ICU_CONFIG --cppflags-searchpath`
|
||||
ICU_LIBS=`$ICU_CONFIG --ldflags --ldflags-icuio`
|
||||
PHP_EVAL_INCLINE($ICU_INCS)
|
||||
PHP_EVAL_LIBLINE($ICU_LIBS, $1)
|
||||
|
||||
ICU_CXXFLAGS=`$ICU_CONFIG --cxxflags`
|
||||
ICU_CXXFLAGS="$ICU_CXXFLAGS -DU_USING_ICU_NAMESPACE=1"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=7
|
||||
PHP_MINOR_VERSION=1
|
||||
PHP_RELEASE_VERSION=27
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=30
|
||||
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`
|
||||
|
||||
|
||||
+52
-26
@@ -1654,10 +1654,10 @@ static int exif_file_sections_free(image_info_type *ImageInfo)
|
||||
/* {{{ exif_iif_add_value
|
||||
Add a value to image_info
|
||||
*/
|
||||
static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel)
|
||||
static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, size_t value_len, int motorola_intel)
|
||||
{
|
||||
size_t idex;
|
||||
void *vptr;
|
||||
void *vptr, *vptr_end;
|
||||
image_info_value *info_value;
|
||||
image_info_data *info_data;
|
||||
image_info_data *list;
|
||||
@@ -1679,8 +1679,12 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
||||
|
||||
switch (format) {
|
||||
case TAG_FMT_STRING:
|
||||
if (length > value_len) {
|
||||
exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "length > value_len: %d > %zu", length, value_len);
|
||||
value = NULL;
|
||||
}
|
||||
if (value) {
|
||||
length = php_strnlen(value, length);
|
||||
length = (int)php_strnlen(value, length);
|
||||
info_value->s = estrndup(value, length);
|
||||
info_data->length = length;
|
||||
} else {
|
||||
@@ -1702,6 +1706,10 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
||||
if (!length)
|
||||
break;
|
||||
case TAG_FMT_UNDEFINED:
|
||||
if (length > value_len) {
|
||||
exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "length > value_len: %d > %zu", length, value_len);
|
||||
value = NULL;
|
||||
}
|
||||
if (value) {
|
||||
if (tag == TAG_MAKER_NOTE) {
|
||||
length = (int) php_strnlen(value, length);
|
||||
@@ -1732,7 +1740,12 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
||||
} else {
|
||||
info_value = &info_data->value;
|
||||
}
|
||||
vptr_end = (char *) value + value_len;
|
||||
for (idex=0,vptr=value; idex<(size_t)length; idex++,vptr=(char *) vptr + php_tiff_bytes_per_format[format]) {
|
||||
if ((char *) vptr_end - (char *) vptr < php_tiff_bytes_per_format[format]) {
|
||||
exif_error_docref("exif_iif_add_value" EXIFERR_CC, image_info, E_WARNING, "Value too short");
|
||||
break;
|
||||
}
|
||||
if (length>1) {
|
||||
info_value = &info_data->value.list[idex];
|
||||
}
|
||||
@@ -1768,7 +1781,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
||||
php_error_docref(NULL, E_WARNING, "Found value of type single");
|
||||
#endif
|
||||
info_value->f = *(float *)value;
|
||||
|
||||
break;
|
||||
case TAG_FMT_DOUBLE:
|
||||
#ifdef EXIF_DEBUG
|
||||
php_error_docref(NULL, E_WARNING, "Found value of type double");
|
||||
@@ -1786,9 +1799,9 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
||||
/* {{{ exif_iif_add_tag
|
||||
Add a tag from IFD to image_info
|
||||
*/
|
||||
static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value)
|
||||
static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, size_t value_len)
|
||||
{
|
||||
exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, image_info->motorola_intel);
|
||||
exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, value_len, image_info->motorola_intel);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2209,7 +2222,7 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
|
||||
*/
|
||||
static void exif_process_COM (image_info_type *image_info, char *value, size_t length)
|
||||
{
|
||||
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2);
|
||||
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2, length-2);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -2224,17 +2237,17 @@ static void exif_process_CME (image_info_type *image_info, char *value, size_t l
|
||||
if (length>3) {
|
||||
switch(value[2]) {
|
||||
case 0:
|
||||
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value);
|
||||
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value, length);
|
||||
break;
|
||||
case 1:
|
||||
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value);
|
||||
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value, length);
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL, E_NOTICE, "Undefined JPEG2000 comment encoding");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL);
|
||||
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL, 0);
|
||||
php_error_docref(NULL, E_NOTICE, "JPEG2000 comment section too small");
|
||||
}
|
||||
}
|
||||
@@ -2741,7 +2754,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;
|
||||
@@ -2794,6 +2807,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
break;
|
||||
default:
|
||||
case MN_OFFSET_NORMAL:
|
||||
data_len = value_len;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2801,6 +2815,10 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
|
||||
return FALSE;
|
||||
}
|
||||
if ((dir_start - value_ptr) > value_len - (2+NumDirEntries*12)) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 0x%04X > 0x%04X", (dir_start - value_ptr) + (2+NumDirEntries*12), value_len);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (de=0;de<NumDirEntries;de++) {
|
||||
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
|
||||
@@ -2822,7 +2840,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
|
||||
{
|
||||
size_t length;
|
||||
int tag, format, components;
|
||||
unsigned int tag, format, components;
|
||||
char *value_ptr, tagname[64], cbuf[32], *outside=NULL;
|
||||
size_t byte_count, offset_val, fpos, fgot;
|
||||
int64_t byte_count_signed;
|
||||
@@ -2873,7 +2891,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
offset_base is ImageInfo->file.list[sn].data-dir_offset
|
||||
dir_entry - offset_base is dir_offset+2+i*12
|
||||
*/
|
||||
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
|
||||
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base) || dir_entry <= offset_base) {
|
||||
/* It is important to check for IMAGE_FILETYPE_TIFF
|
||||
* JPEG does not use absolute pointers instead its pointers are
|
||||
* relative to the start of the TIFF header in APP1 section. */
|
||||
@@ -3133,7 +3151,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
}
|
||||
}
|
||||
}
|
||||
exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table), tag, format, components, value_ptr);
|
||||
exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table), tag, format, components, value_ptr, byte_count);
|
||||
EFREE_IF(outside);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -3291,10 +3309,10 @@ static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t
|
||||
size_t l1, l2=0;
|
||||
|
||||
if ((l1 = php_strnlen(buffer+2, length-2)) > 0) {
|
||||
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2);
|
||||
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2, l1);
|
||||
if (length > 2+l1+1) {
|
||||
l2 = php_strnlen(buffer+2+l1+1, length-2-l1-1);
|
||||
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1);
|
||||
exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1, l2);
|
||||
}
|
||||
}
|
||||
#ifdef EXIF_DEBUG
|
||||
@@ -3508,8 +3526,10 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
|
||||
if (c == 0xFF)
|
||||
return FALSE;
|
||||
marker = c;
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
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
|
||||
@@ -3530,6 +3550,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;
|
||||
@@ -3567,10 +3591,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);
|
||||
@@ -3578,8 +3602,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
|
||||
@@ -3662,9 +3686,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;
|
||||
}
|
||||
@@ -4091,7 +4115,7 @@ PHP_FUNCTION(exif_read_data)
|
||||
if (ImageInfo.Thumbnail.size) {
|
||||
if (read_thumbnail) {
|
||||
/* not exif_iif_add_str : this is a buffer */
|
||||
exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data);
|
||||
exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size);
|
||||
}
|
||||
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
|
||||
/* try to evaluate if thumbnail data is present */
|
||||
@@ -4177,7 +4201,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_dtor(p_width);
|
||||
zval_dtor(p_height);
|
||||
|
||||
Binary file not shown.
@@ -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.
@@ -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/bug77563.php on line %d
|
||||
|
||||
Warning: exif_thumbnail(bug77563.jpg): File structure corrupted in %s/bug77563.php on line %d
|
||||
|
||||
Warning: exif_thumbnail(bug77563.jpg): Invalid JPEG file in %s/bug77563.php on line %d
|
||||
DONE
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #77753 (Heap-buffer-overflow in php_ifd_get32s)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(exif_read_data(__DIR__."/bug77753.tiff"));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
%A
|
||||
Warning: exif_read_data(bug77753.tiff): Illegal IFD size: 0x006A > 0x0065 in %sbug77753.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug77753.tiff): Invalid TIFF file in %sbug77753.php on line %d
|
||||
bool(false)
|
||||
DONE
|
||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #77831 (Heap-buffer-overflow in exif_iif_add_value in EXIF)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(exif_read_data(__DIR__."/bug77831.tiff"));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
%A
|
||||
bool(false)
|
||||
DONE
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #77950 (Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__."/bug77950.tiff");
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
%A
|
||||
DONE
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #77988 (heap-buffer-overflow on php_jpg_get16)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
exif_read_data(__DIR__."/bug77988.jpg", 'COMMENT', FALSE, TRUE);
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
DONE
|
||||
+5
-1
@@ -135,7 +135,11 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd)
|
||||
}
|
||||
h[3] = ch;
|
||||
}
|
||||
sscanf(h, "%x", &b);
|
||||
if (sscanf(h, "%x", &b) != 1) {
|
||||
php_gd_error("invalid XBM");
|
||||
gdImageDestroy(im);
|
||||
return 0;
|
||||
}
|
||||
for (bit = 1; bit <= max_bit; bit = bit << 1) {
|
||||
gdImageSetPixel(im, x++, y, (b & bit) ? 1 : 0);
|
||||
if (x == im->sx) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #77973 (Uninitialized read in gdImageCreateFromXbm)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available");
|
||||
if (!function_exists('imagecreatefromxbm')) die("skip imagecreatefromxbm not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$contents = hex2bin("23646566696e6520776964746820320a23646566696e652068656967687420320a737461746963206368617220626974735b5d203d7b0a7a7a787a7a");
|
||||
$filepath = __DIR__ . '/bug77973.xbm';
|
||||
file_put_contents($filepath, $contents);
|
||||
$im = imagecreatefromxbm($filepath);
|
||||
var_dump($im);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromxbm(): invalid XBM in %s on line %d
|
||||
|
||||
Warning: imagecreatefromxbm(): '%s' is not a valid XBM file in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(__DIR__ . '/bug77973.xbm');
|
||||
?>
|
||||
@@ -191,7 +191,7 @@ static void PHP_SHA3_Final(unsigned char* digest,
|
||||
}
|
||||
|
||||
// Zero out context
|
||||
memset(ctx, 0, sizeof(PHP_SHA3_CTX));
|
||||
ZEND_SECURE_ZERO(ctx, sizeof(PHP_SHA3_CTX));
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
@@ -129,7 +129,7 @@ static inline void SnefruTransform(PHP_SNEFRU_CTX *context, const unsigned char
|
||||
((input[i+2] & 0xff) << 8) | (input[i+3] & 0xff);
|
||||
}
|
||||
Snefru(context->state);
|
||||
memset(&context->state[8], 0, sizeof(uint32_t) * 8);
|
||||
ZEND_SECURE_ZERO(&context->state[8], sizeof(uint32_t) * 8);
|
||||
}
|
||||
|
||||
PHP_HASH_API void PHP_SNEFRUInit(PHP_SNEFRU_CTX *context)
|
||||
|
||||
+3
-1
@@ -1673,7 +1673,9 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
|
||||
* we can do at this point. */
|
||||
if (*(p1 + 1) == '=') {
|
||||
++p1;
|
||||
--str_left;
|
||||
if (str_left > 1) {
|
||||
--str_left;
|
||||
}
|
||||
}
|
||||
|
||||
err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #78069 (Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip ext/iconv required');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$hdr = iconv_mime_decode_headers(file_get_contents(__DIR__ . "/bug78069.data"),2);
|
||||
var_dump(count($hdr));
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
int(1)
|
||||
DONE
|
||||
@@ -451,13 +451,18 @@ static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patl
|
||||
OnigErrorInfo err_info;
|
||||
OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];
|
||||
|
||||
if (!php_mb_check_encoding(pattern, patlen, _php_mb_regex_mbctype2name(enc))) {
|
||||
php_error_docref(NULL, E_WARNING,
|
||||
"Pattern is not valid under %s encoding", _php_mb_regex_mbctype2name(enc));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = zend_hash_str_find_ptr(&MBREX(ht_rc), (char *)pattern, patlen);
|
||||
if (!rc || onig_get_options(rc) != options || onig_get_encoding(rc) != enc || onig_get_syntax(rc) != syntax) {
|
||||
if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) {
|
||||
onig_error_code_to_str(err_str, err_code, &err_info);
|
||||
php_error_docref(NULL, E_WARNING, "mbregex compile err: %s", err_str);
|
||||
retval = NULL;
|
||||
goto out;
|
||||
return NULL;
|
||||
}
|
||||
if (rc == MBREX(search_re)) {
|
||||
/* reuse the new rc? see bug #72399 */
|
||||
@@ -467,7 +472,6 @@ static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patl
|
||||
} else {
|
||||
retval = rc;
|
||||
}
|
||||
out:
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1110,6 +1114,11 @@ PHP_FUNCTION(mb_split)
|
||||
count--;
|
||||
}
|
||||
|
||||
if (!php_mb_check_encoding(string, string_len,
|
||||
_php_mb_regex_mbctype2name(MBREX(current_mbctype)))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* create regex pattern buffer */
|
||||
if ((re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, MBREX(regex_default_options), MBREX(current_mbctype), MBREX(regex_default_syntax))) == NULL) {
|
||||
RETURN_FALSE;
|
||||
@@ -1199,6 +1208,11 @@ PHP_FUNCTION(mb_ereg_match)
|
||||
}
|
||||
}
|
||||
|
||||
if (!php_mb_check_encoding(string, string_len,
|
||||
_php_mb_regex_mbctype2name(MBREX(current_mbctype)))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if ((re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBREX(current_mbctype), syntax)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -13,5 +13,7 @@ var_dump($var1);
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: var in %s on line %d
|
||||
string(0) ""
|
||||
|
||||
Warning: mbereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -6,8 +6,6 @@ Bug #77370 (Buffer overflow on mb regex functions - fetch_token)
|
||||
<?php
|
||||
var_dump(mb_split(" \xfd",""));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
}
|
||||
--EXPECTF--
|
||||
Warning: mb_split(): Pattern is not valid under UTF-8 encoding in %s on line %d
|
||||
bool(false)
|
||||
@@ -6,5 +6,6 @@ Bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
|
||||
<?php
|
||||
var_dump(mb_ereg("()0\xfc00000\xfc00000\xfc00000\xfc",""));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
--EXPECTF--
|
||||
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
|
||||
bool(false)
|
||||
@@ -9,8 +9,15 @@ var_dump(mb_ereg("(?i)000000000000000000000\xf0",""));
|
||||
var_dump(mb_ereg("0000\\"."\xf5","0"));
|
||||
var_dump(mb_ereg("(?i)FFF00000000000000000\xfd",""));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
--EXPECTF--
|
||||
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
|
||||
bool(false)
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Bug #77371 (Heap overflow in utf32be_mbc_to_code)
|
||||
Bug #77418 (Heap overflow in utf32be_mbc_to_code)
|
||||
--SKIPIF--
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--FILE--
|
||||
@@ -8,7 +8,4 @@ mb_regex_encoding("UTF-32");
|
||||
var_dump(mb_split("\x00\x00\x00\x5c\x00\x00\x00B","000000000000000000000000000000"));
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(30) "000000000000000000000000000000"
|
||||
}
|
||||
bool(false)
|
||||
@@ -109,13 +109,17 @@ string(10) "string_val"
|
||||
string(10) "string_val"
|
||||
|
||||
-- Iteration 4 --
|
||||
string(10) "string_val"
|
||||
|
||||
Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
string(10) "string_val"
|
||||
|
||||
-- Iteration 6 --
|
||||
string(10) "string_val"
|
||||
|
||||
Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
string(10) "string_val"
|
||||
|
||||
@@ -605,6 +605,8 @@ PHP_FUNCTION(mcrypt_generic_init)
|
||||
}
|
||||
RETVAL_LONG(result);
|
||||
|
||||
ZEND_SECURE_ZERO(key_s, key_len);
|
||||
ZEND_SECURE_ZERO(iv_s, iv_len);
|
||||
efree(iv_s);
|
||||
efree(key_s);
|
||||
}
|
||||
|
||||
@@ -6339,7 +6339,7 @@ static int php_openssl_cipher_update(const EVP_CIPHER *cipher_type,
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (mode->is_single_run_aead && !EVP_EncryptUpdate(cipher_ctx, NULL, &i, NULL, (int)data_len)) {
|
||||
if (mode->is_single_run_aead && !EVP_CipherUpdate(cipher_ctx, NULL, &i, NULL, (int)data_len)) {
|
||||
php_openssl_store_errors();
|
||||
php_error_docref(NULL, E_WARNING, "Setting of data length failed");
|
||||
return FAILURE;
|
||||
|
||||
@@ -1385,6 +1385,9 @@ int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int a
|
||||
/* 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
@@ -762,7 +762,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);
|
||||
|
||||
@@ -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
|
||||
@@ -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/bug77396.php:%d
|
||||
Stack trace:
|
||||
#0 %s/bug77396.php(%d): PharData->__construct(%s)
|
||||
#1 {main}
|
||||
thrown in %s/bug77396.php on line %d
|
||||
@@ -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
@@ -0,0 +1 @@
|
||||
target
|
||||
@@ -1110,7 +1110,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -28,6 +28,7 @@ extern zend_module_entry sqlite3_module_entry;
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(sqlite3)
|
||||
char *extension_dir;
|
||||
int dbconfig_defensive;
|
||||
ZEND_END_MODULE_GLOBALS(sqlite3)
|
||||
|
||||
#ifdef ZTS
|
||||
|
||||
@@ -81,6 +81,9 @@ static void php_sqlite3_error(php_sqlite3_db_object *db_obj, char *format, ...)
|
||||
*/
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("sqlite3.extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateString, extension_dir, zend_sqlite3_globals, sqlite3_globals)
|
||||
#if SQLITE_VERSION_NUMBER >= 3026000
|
||||
STD_PHP_INI_ENTRY("sqlite3.defensive", "1", PHP_INI_SYSTEM, OnUpdateBool, dbconfig_defensive, zend_sqlite3_globals, sqlite3_globals)
|
||||
#endif
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
||||
@@ -166,6 +169,12 @@ PHP_METHOD(sqlite3, open)
|
||||
sqlite3_set_authorizer(db_obj->db, php_sqlite3_authorizer, NULL);
|
||||
}
|
||||
|
||||
#if SQLITE_VERSION_NUMBER >= 3026000
|
||||
if (SQLITE3G(dbconfig_defensive)) {
|
||||
sqlite3_db_config(db_obj->db, SQLITE_DBCONFIG_DEFENSIVE, 1, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fullpath != filename) {
|
||||
efree(fullpath);
|
||||
}
|
||||
@@ -2025,6 +2034,15 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char *ar
|
||||
case SQLITE_ATTACH:
|
||||
{
|
||||
if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) {
|
||||
if (strncmp(arg3, "file:", 5) == 0) {
|
||||
/* starts with "file:" */
|
||||
if (!arg3[5]) {
|
||||
return SQLITE_DENY;
|
||||
}
|
||||
if (php_check_open_basedir(arg3 + 5)) {
|
||||
return SQLITE_DENY;
|
||||
}
|
||||
}
|
||||
if (php_check_open_basedir(arg3)) {
|
||||
return SQLITE_DENY;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
SQLite3 defensive mode ini setting
|
||||
--SKIPIF--
|
||||
<?php require_once(__DIR__ . '/skipif.inc');
|
||||
|
||||
if (SQLite3::version()['versionNumber'] < 3026000) {
|
||||
die("skip: sqlite3 library version < 3.26: no support for defensive mode");
|
||||
}
|
||||
|
||||
?>
|
||||
--INI--
|
||||
sqlite3.defensive=On
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db = new SQLite3(':memory:');
|
||||
var_dump($db->exec('CREATE TABLE test (a, b);'));
|
||||
|
||||
// This does not generate an error!
|
||||
var_dump($db->exec('PRAGMA writable_schema = ON;'));
|
||||
var_dump($db->querySingle('PRAGMA writable_schema;'));
|
||||
|
||||
// Should be 1
|
||||
var_dump($db->querySingle('SELECT COUNT(*) FROM sqlite_master;'));
|
||||
|
||||
// Should generate an error!
|
||||
var_dump($db->querySingle('DELETE FROM sqlite_master;'));
|
||||
|
||||
// Should still be 1
|
||||
var_dump($db->querySingle('SELECT COUNT(*) FROM sqlite_master;'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(1)
|
||||
int(1)
|
||||
|
||||
Warning: SQLite3::querySingle(): Unable to prepare statement: 1, table sqlite_master may not be modified in %s on line %d
|
||||
bool(false)
|
||||
int(1)
|
||||
@@ -364,7 +364,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out)
|
||||
PHP_MD5Update(&ctx, final, (unsigned int)(pl > 16 ? 16 : pl));
|
||||
|
||||
/* Don't leave anything around in vm they could use. */
|
||||
memset(final, 0, sizeof(final));
|
||||
ZEND_SECURE_ZERO(final, sizeof(final));
|
||||
|
||||
/* Then something really weird... */
|
||||
for (i = pwl; i != 0; i >>= 1)
|
||||
|
||||
+2
-2
@@ -245,7 +245,7 @@ PHPAPI void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context)
|
||||
|
||||
/* Zeroize sensitive information.
|
||||
*/
|
||||
memset((unsigned char*) context, 0, sizeof(*context));
|
||||
ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -356,7 +356,7 @@ const unsigned char block[64];
|
||||
state[4] += e;
|
||||
|
||||
/* Zeroize sensitive information. */
|
||||
memset((unsigned char*) x, 0, sizeof(x));
|
||||
ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_MAJOR_VERSION 7
|
||||
#define PHP_MINOR_VERSION 1
|
||||
#define PHP_RELEASE_VERSION 27
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "7.1.27-dev"
|
||||
#define PHP_VERSION_ID 70127
|
||||
#define PHP_RELEASE_VERSION 30
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "7.1.30"
|
||||
#define PHP_VERSION_ID 70130
|
||||
@@ -1168,34 +1168,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) && !defined(NETWARE)
|
||||
/* 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) {
|
||||
success = 1;
|
||||
# if !defined(TSRM_WIN32) && !defined(NETWARE)
|
||||
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;
|
||||
}
|
||||
/*
|
||||
* 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) && !defined(NETWARE)
|
||||
umask(oldmask);
|
||||
# endif
|
||||
return success;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -991,8 +991,19 @@ cli_server.color = On
|
||||
;intl.use_exceptions = 0
|
||||
|
||||
[sqlite3]
|
||||
; Directory pointing to SQLite3 extensions
|
||||
; http://php.net/sqlite3.extension-dir
|
||||
;sqlite3.extension_dir =
|
||||
|
||||
; SQLite defensive mode flag (only available from SQLite 3.26+)
|
||||
; When the defensive flag is enabled, language features that allow ordinary
|
||||
; SQL to deliberately corrupt the database file are disabled. This forbids
|
||||
; writing directly to the schema, shadow tables (eg. FTS data tables), or
|
||||
; the sqlite_dbpage virtual table.
|
||||
; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html
|
||||
; (for older SQLite versions, this flag has no use)
|
||||
sqlite3.defensive = 1
|
||||
|
||||
[Pcre]
|
||||
;PCRE library backtracking limit.
|
||||
; http://php.net/pcre.backtrack-limit
|
||||
|
||||
@@ -991,8 +991,19 @@ cli_server.color = On
|
||||
;intl.use_exceptions = 0
|
||||
|
||||
[sqlite3]
|
||||
; Directory pointing to SQLite3 extensions
|
||||
; http://php.net/sqlite3.extension-dir
|
||||
;sqlite3.extension_dir =
|
||||
|
||||
; SQLite defensive mode flag (only available from SQLite 3.26+)
|
||||
; When the defensive flag is enabled, language features that allow ordinary
|
||||
; SQL to deliberately corrupt the database file are disabled. This forbids
|
||||
; writing directly to the schema, shadow tables (eg. FTS data tables), or
|
||||
; the sqlite_dbpage virtual table.
|
||||
; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html
|
||||
; (for older SQLite versions, this flag has no use)
|
||||
sqlite3.defensive = 1
|
||||
|
||||
[Pcre]
|
||||
;PCRE library backtracking limit.
|
||||
; http://php.net/pcre.backtrack-limit
|
||||
|
||||
+7
-6
@@ -274,8 +274,9 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (headers_lc) {
|
||||
zend_string_free(headers_lc);
|
||||
if (headers) {
|
||||
zend_string_release(headers_trim);
|
||||
zend_string_release(headers_lc);
|
||||
}
|
||||
*error = W32_SM_SENDMAIL_FROM_NOT_SET;
|
||||
return FAILURE;
|
||||
@@ -289,8 +290,8 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
|
||||
efree(RPath);
|
||||
}
|
||||
if (headers) {
|
||||
zend_string_free(headers_trim);
|
||||
zend_string_free(headers_lc);
|
||||
zend_string_release(headers_trim);
|
||||
zend_string_release(headers_lc);
|
||||
}
|
||||
/* 128 is safe here, the specifier in snprintf isn't longer than that */
|
||||
if (NULL == (*error_message = ecalloc(1, HOST_NAME_LEN + 128))) {
|
||||
@@ -308,8 +309,8 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
|
||||
efree(RPath);
|
||||
}
|
||||
if (headers) {
|
||||
zend_string_free(headers_trim);
|
||||
zend_string_free(headers_lc);
|
||||
zend_string_release(headers_trim);
|
||||
zend_string_release(headers_lc);
|
||||
}
|
||||
if (ret != SUCCESS) {
|
||||
*error = ret;
|
||||
|
||||
Reference in new issue
Block a user