diff --git a/EXTENSIONS b/EXTENSIONS index 9461db5c786..996a8ed4c56 100644 --- a/EXTENSIONS +++ b/EXTENSIONS @@ -269,7 +269,7 @@ STATUS: Working SINCE: 5.3 ------------------------------------------------------------------------------- EXTENSION: exif -PRIMARY MAINTAINER: Marcus Boerger +PRIMARY MAINTAINER: Kalle Sommer Nielsen MAINTENANCE: Maintained STATUS: Working SINCE: 4.2 diff --git a/NEWS b/NEWS index 8a05976893c..d9c1e5baf7f 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,21 @@ PHP NEWS unserialize). (Nikita) . Fixed bug #74819 (wddx_deserialize() heap out-of-bound read via php_parse_date()). (Derick) + . Fixed bug #74878 (Data race in ZTS builds). (Nikita) + +- Date: + . Fixed bug #74852 (property_exists returns true on unknown DateInterval + property). (jhdxr) + +- EXIF: + . Deprecated the read_exif_data() alias. (Kalle) + . Fixed bug #74428 (exif_read_data(): "Illegal IFD size" warning occurs with + correct exif format). (bradpiccho at gmail dot com, Kalle) + . Fixed bug #72819 (EXIF thumbnails not read anymore). (Kalle) + . Fixed bug #62523 (php crashes with segfault when exif_read_data called). + (Kalle) + . Fixed bug #50660 (exif_read_data(): Illegal IFD offset (works fine with + other exif readers). (skinny dot bravo at gmail dot com, Kalle) - GD: . Fixed bug #74435 (Buffer over-read into uninitialized memory). (cmb) @@ -25,6 +40,10 @@ PHP NEWS . Fixed bug #74873 (Minor BC break: PCRE_JIT changes output of preg_match()). (Dmitry) +- SQLite3: + . Fixed bug #74883 (SQLite3::__construct() produces "out of memory" exception + with invalid flags). (Anatol) + 06 Jul 2017, PHP 7.2.0alpha3 - Core: @@ -229,6 +248,8 @@ PHP NEWS . Fixed bug #73961 (environmental build dependency in hash sha3 source). (krakjoe) . Changed HashContext from resource to object. (Rouven Weßling, Sara) + . Disallowed usage of non-cryptographic hash functions with HMAC and PBKDF2. + (Andrey Andreev, Nikita) - intl: . Fixed bug #74433 (wrong reflection for Normalizer methods). (villfa) diff --git a/UPGRADING b/UPGRADING index 9813574a18e..7f4817ab24d 100644 --- a/UPGRADING +++ b/UPGRADING @@ -49,8 +49,8 @@ PHP 7.2 UPGRADE NOTES example `bcmod('4', '3.5')` now returns '0.5' instead of '1'. - Hash: - . The hash_hmac(), hash_hmac_file() and hash_pbkdf2() functions no longer - accept non-cryptographic hashes. + . The hash_hmac(), hash_hmac_file(), hash_pbkdf2() and hash_init() (with + HASH_HMAC) functions no longer accept non-cryptographic hashes. - JSON . The json_decode() option JSON_OBJECT_AS_ARRAY is used if the second @@ -164,6 +164,9 @@ PHP 8.0. . The create_function() function has been deprecated, use anonymous functions instead. . The each() function has been deprecated, use a foreach loop instead. + +- EXIF: + . The read_exif_data() alias have been deprecated, use exif_read_data() instead. - GD: . png2wbmp() and jpeg2wbmp() have been deprecated. diff --git a/Zend/zend_API.c b/Zend/zend_API.c index ca8b4e2f997..609e8b4a515 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3742,6 +3742,10 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z break; } } + + /* Must be interned to avoid ZTS data races */ + name = zend_new_interned_string(zend_string_copy(name)); + if (access_type & ZEND_ACC_PUBLIC) { property_info->name = zend_string_copy(name); } else if (access_type & ZEND_ACC_PRIVATE) { diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 5bd9b8ee5db..d95903a5e65 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2016,7 +2016,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void zval *prop; int retval = 0; - if (Z_TYPE_P(member) != IS_STRING) { + if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) { ZVAL_COPY(&tmp_member, member); convert_to_string(&tmp_member); member = &tmp_member; @@ -2032,10 +2032,10 @@ static int date_interval_has_property(zval *object, zval *member, int type, void } return retval; } - - prop = date_interval_read_property(object, member, type, cache_slot, &rv); - - if (prop != NULL) { + + prop = date_interval_read_property(object, member, BP_VAR_IS, cache_slot, &rv); + + if (prop != &EG(uninitialized_zval)) { if (type == 2) { retval = 1; } else if (type == 1) { diff --git a/ext/date/tests/bug74852.phpt b/ext/date/tests/bug74852.phpt new file mode 100644 index 00000000000..e293bef8bfe --- /dev/null +++ b/ext/date/tests/bug74852.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #74852 property_exists returns true on unknown DateInterval property +--FILE-- +abcde)); +var_dump($interval->abcde); + +?> +--EXPECTF-- +bool(false) +bool(false) + +Notice: Undefined property: DateInterval::$abcde in %s on line %d +NULL diff --git a/ext/exif/exif.c b/ext/exif/exif.c index ab920223405..736cfdb9bc3 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -120,7 +120,7 @@ ZEND_END_ARG_INFO() */ const zend_function_entry exif_functions[] = { PHP_FE(exif_read_data, arginfo_exif_read_data) - PHP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data) + PHP_DEP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data) PHP_FE(exif_tagname, arginfo_exif_tagname) PHP_FE(exif_thumbnail, arginfo_exif_thumbnail) PHP_FE(exif_imagetype, arginfo_exif_imagetype) @@ -1340,8 +1340,10 @@ typedef enum mn_byte_order_t { typedef enum mn_offset_mode_t { MN_OFFSET_NORMAL, - MN_OFFSET_MAKER, - MN_OFFSET_GUESS + MN_OFFSET_MAKER +#ifdef KALLE_0 + , MN_OFFSET_GUESS +#endif } mn_offset_mode_t; typedef struct { @@ -1357,7 +1359,7 @@ typedef struct { /* Remember to update PHP_MINFO if updated */ static const maker_note_type maker_note_array[] = { - { tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_INTEL, MN_OFFSET_GUESS}, + { tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_INTEL, MN_OFFSET_NORMAL}, { tag_table_VND_CASIO, "CASIO", NULL, NULL, 0, 0, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL}, { tag_table_VND_FUJI, "FUJIFILM", NULL, "FUJIFILM\x0C\x00\x00\x00", 12, 12, MN_ORDER_INTEL, MN_OFFSET_MAKER}, { tag_table_VND_NIKON, "NIKON", NULL, "Nikon\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, @@ -2677,7 +2679,7 @@ static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result) /* }}} */ /* forward declarations */ -static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index); +static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag); 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); /* {{{ exif_get_markername @@ -3118,7 +3120,10 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu { size_t i; int de, section_index = SECTION_MAKERNOTE; - int NumDirEntries, old_motorola_intel, offset_diff; + int NumDirEntries, old_motorola_intel; +#ifdef KALLE_0 + int offset_diff; +#endif const maker_note_type *maker_note; char *dir_start; @@ -3176,6 +3181,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu case MN_OFFSET_MAKER: offset_base = value_ptr; break; +#ifdef KALLE_0 case MN_OFFSET_GUESS: if (maker_note->offset + 10 + 4 >= value_len) { /* Can not read dir_start+10 since it's beyond value end */ @@ -3192,6 +3198,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu } offset_base = value_ptr + offset_diff; break; +#endif default: case MN_OFFSET_NORMAL: break; @@ -3524,7 +3531,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD Pointer"); return FALSE; } - if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index)) { + if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index, tag)) { return FALSE; } #ifdef EXIF_DEBUG @@ -3541,11 +3548,11 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha /* {{{ exif_process_IFD_in_JPEG * Process one of the nested IFDs directories. */ -static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index) +static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag) { int de; int NumDirEntries; - int NextDirOffset; + int NextDirOffset = 0; #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process %s (x%04X(=%d))", exif_get_sectionname(section_index), IFDlength, IFDlength); @@ -3553,7 +3560,7 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, ImageInfo->sections_found |= FOUND_IFD0; - if ((dir_start + 2) >= (offset_base+IFDlength)) { + if ((dir_start + 2) > (offset_base+IFDlength)) { exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size"); return FALSE; } @@ -3581,11 +3588,15 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, * Hack to make it process IDF1 I hope * There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail */ - if ((dir_start+2+12*de + 4) >= (offset_base+IFDlength)) { + if ((dir_start+2+12*de + 4) > (offset_base+IFDlength)) { exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size"); return FALSE; } - NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel); + + if (tag != TAG_EXIF_IFD_POINTER && tag != TAG_GPS_IFD_POINTER) { + NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel); + } + if (NextDirOffset) { /* the next line seems false but here IFDlength means length of all IFDs */ if (offset_base + NextDirOffset < offset_base || offset_base + NextDirOffset > offset_base+IFDlength) { @@ -3596,7 +3607,7 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Expect next IFD to be thumbnail"); #endif - if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displacement, SECTION_THUMBNAIL)) { + if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displacement, SECTION_THUMBNAIL, 0)) { #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail size: 0x%04X", ImageInfo->Thumbnail.size); #endif @@ -3651,7 +3662,7 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, ImageInfo->sections_found |= FOUND_IFD0; /* First directory starts at offset 8. Offsets starts at 0. */ - exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, SECTION_IFD0); + exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, SECTION_IFD0, 0); #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process TIFF in JPEG done"); diff --git a/ext/exif/tests/bug50660/bug50660-1.jpg b/ext/exif/tests/bug50660/bug50660-1.jpg new file mode 100644 index 00000000000..9a903c0b7c0 Binary files /dev/null and b/ext/exif/tests/bug50660/bug50660-1.jpg differ diff --git a/ext/exif/tests/bug50660/bug50660-2.jpg b/ext/exif/tests/bug50660/bug50660-2.jpg new file mode 100644 index 00000000000..9f85473f479 Binary files /dev/null and b/ext/exif/tests/bug50660/bug50660-2.jpg differ diff --git a/ext/exif/tests/bug50660/bug50660.phpt b/ext/exif/tests/bug50660/bug50660.phpt new file mode 100644 index 00000000000..00a83ce4b0c --- /dev/null +++ b/ext/exif/tests/bug50660/bug50660.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #50660 (exif_read_data(): Illegal IFD offset (works fine with other exif readers)) +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- + +===DONE=== +--EXPECT-- +bool(true) +bool(true) +===DONE=== diff --git a/ext/exif/tests/bug62523_1.jpg b/ext/exif/tests/bug62523_1.jpg index 9a63d1e84d9..b3c2934d96a 100644 Binary files a/ext/exif/tests/bug62523_1.jpg and b/ext/exif/tests/bug62523_1.jpg differ diff --git a/ext/exif/tests/bug62523_1.phpt b/ext/exif/tests/bug62523_1.phpt index d79b544eb03..c1c8d7ff8b8 100644 --- a/ext/exif/tests/bug62523_1.phpt +++ b/ext/exif/tests/bug62523_1.phpt @@ -7,12 +7,10 @@ extension_loaded("exif") or die("skip need exif"); --FILE-- Done ---EXPECTF-- +--EXPECT-- Test - -Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d -bool(false) +int(86) Done diff --git a/ext/exif/tests/bug62523_2.phpt b/ext/exif/tests/bug62523_2.phpt index 689ed0679df..ddc8ae824e8 100644 --- a/ext/exif/tests/bug62523_2.phpt +++ b/ext/exif/tests/bug62523_2.phpt @@ -10,9 +10,7 @@ echo "Test\n"; var_dump(count(exif_read_data(__DIR__."/bug62523_2.jpg"))); ?> Done ---EXPECTF-- +--EXPECT-- Test - -Warning: exif_read_data(bug62523_2.jpg): IFD data bad offset: 0xADB23672 length 0x0D94 in %s%ebug62523_2.php on line %d -int(30) +int(76) Done diff --git a/ext/exif/tests/bug72819/bug72819.jpg b/ext/exif/tests/bug72819/bug72819.jpg new file mode 100644 index 00000000000..933719d1cf7 Binary files /dev/null and b/ext/exif/tests/bug72819/bug72819.jpg differ diff --git a/ext/exif/tests/bug72819/bug72819.phpt b/ext/exif/tests/bug72819/bug72819.phpt new file mode 100644 index 00000000000..f71fa316632 --- /dev/null +++ b/ext/exif/tests/bug72819/bug72819.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #72819 (EXIF thumbnails not read anymore) +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- + +===DONE=== +--EXPECT-- +int(5448) +===DONE=== diff --git a/ext/exif/tests/bug73115/bug73115.JPG b/ext/exif/tests/bug73115/bug73115.JPG new file mode 100644 index 00000000000..25710d622a5 Binary files /dev/null and b/ext/exif/tests/bug73115/bug73115.JPG differ diff --git a/ext/exif/tests/bug73115/bug73115.phpt b/ext/exif/tests/bug73115/bug73115.phpt new file mode 100644 index 00000000000..84c20219f9c --- /dev/null +++ b/ext/exif/tests/bug73115/bug73115.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #73115 (exif_read_data triggers warning on reading binary strings) +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- + +===DONE=== +--EXPECT-- +int(80) +===DONE=== diff --git a/ext/exif/tests/bug74428/bug74428.jpg b/ext/exif/tests/bug74428/bug74428.jpg new file mode 100644 index 00000000000..73c7805cec3 Binary files /dev/null and b/ext/exif/tests/bug74428/bug74428.jpg differ diff --git a/ext/exif/tests/bug74428/bug74428.phpt b/ext/exif/tests/bug74428/bug74428.phpt new file mode 100644 index 00000000000..b2beca3f21b --- /dev/null +++ b/ext/exif/tests/bug74428/bug74428.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #74428 (exif_read_data(): "Illegal IFD size" warning occurs with correct exif format) +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- + +===DONE=== +--EXPECTF-- +array(11) { + ["FileName"]=> + string(12) "bug74428.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(1902) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(19) "ANY_TAG, IFD0, EXIF" + ["COMPUTED"]=> + array(5) { + ["html"]=> + string(22) "width="88" height="28"" + ["Height"]=> + int(28) + ["Width"]=> + int(88) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + } + ["Orientation"]=> + int(1) + ["Exif_IFD_Pointer"]=> + int(38) + ["ExifImageWidth"]=> + int(88) + ["ExifImageLength"]=> + int(28) +} +===DONE=== diff --git a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt b/ext/exif/tests/exif_read_exif_data_basic-mb.phpt index 2f6a1a4103d..b70be242787 100644 --- a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt +++ b/ext/exif/tests/exif_read_exif_data_basic-mb.phpt @@ -19,6 +19,8 @@ print_r(read_exif_data(dirname(__FILE__).'/test2私はガラスを食べられ ===Done=== --EXPECTF-- *** Testing read_exif_data() : basic functionality *** + +Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic-mb.php on line 9 Array ( [FileName] => test2私はガラスを食べられます.jpg diff --git a/ext/exif/tests/exif_read_exif_data_basic.phpt b/ext/exif/tests/exif_read_exif_data_basic.phpt index 435f13752ac..ddf847de05c 100644 --- a/ext/exif/tests/exif_read_exif_data_basic.phpt +++ b/ext/exif/tests/exif_read_exif_data_basic.phpt @@ -19,6 +19,8 @@ print_r(read_exif_data(dirname(__FILE__).'/test2.jpg')); ===Done=== --EXPECTF-- *** Testing read_exif_data() : basic functionality *** + +Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic.php on line 9 Array ( [FileName] => test2.jpg diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 04c98d836d6..a74ff8d9713 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -103,6 +103,7 @@ PHP_METHOD(sqlite3, open) char *filename, *encryption_key, *fullpath; size_t filename_len, encryption_key_len = 0; zend_long flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; + int rc; db_obj = Z_SQLITE3_DB_P(object); @@ -133,11 +134,13 @@ PHP_METHOD(sqlite3, open) } #if SQLITE_VERSION_NUMBER >= 3005000 - if (sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL) != SQLITE_OK) { + rc = sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL); #else - if (sqlite3_open(fullpath, &(db_obj->db)) != SQLITE_OK) { + rc = sqlite3_open(fullpath, &(db_obj->db)); #endif - zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db)); + if (rc != SQLITE_OK) { + zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", + db_obj->db ? sqlite3_errmsg(db_obj->db) : sqlite3_errstr(rc)); if (fullpath != filename) { efree(fullpath); } diff --git a/ext/standard/tests/network/bug73594.phpt b/ext/standard/tests/network/bug73594.phpt index a3068360ce0..370b6162fde 100644 --- a/ext/standard/tests/network/bug73594.phpt +++ b/ext/standard/tests/network/bug73594.phpt @@ -19,8 +19,9 @@ if (empty($out)) die("skip local resolver does not return additional records"); --EXPECT-- bool(false) diff --git a/ext/standard/tests/network/bug73594a.phpt b/ext/standard/tests/network/bug73594a.phpt index a0a08e4a9e9..9a07fb71ed4 100644 --- a/ext/standard/tests/network/bug73594a.phpt +++ b/ext/standard/tests/network/bug73594a.phpt @@ -18,8 +18,9 @@ if (empty($out)) die("skip local resolver does not return authority records"); --FILE-- --EXPECT-- bool(false) diff --git a/main/SAPI.c b/main/SAPI.c index 26846fb47c1..c841c6e789a 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -646,7 +646,7 @@ static void sapi_header_add_op(sapi_header_op_enum op, sapi_header_struct *sapi_ char sav = *colon_offset; *colon_offset = 0; - sapi_remove_header(&SG(sapi_headers).headers, sapi_header->header, (int)strlen(sapi_header->header)); + sapi_remove_header(&SG(sapi_headers).headers, sapi_header->header, strlen(sapi_header->header)); *colon_offset = sav; } } diff --git a/main/SAPI.h b/main/SAPI.h index 6914ed43276..1516702edfa 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -327,4 +327,6 @@ END_EXTERN_C() * tab-width: 4 * c-basic-offset: 4 * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 */ diff --git a/main/explicit_bzero.c b/main/explicit_bzero.c index 6bea9e3df27..e99e082e6da 100644 --- a/main/explicit_bzero.c +++ b/main/explicit_bzero.c @@ -41,3 +41,11 @@ PHPAPI void php_explicit_bzero(void *dst, size_t siz) __explicit_bzero_hook(dst, siz); } #endif +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 5e48610131e..12de33be832 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -140,8 +140,8 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path char local_open_basedir[MAXPATHLEN]; char path_tmp[MAXPATHLEN]; char *path_file; - int resolved_basedir_len; - int resolved_name_len; + size_t resolved_basedir_len; + size_t resolved_name_len; size_t path_len; int nesting_level = 0; @@ -214,9 +214,9 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path /* Resolve open_basedir to resolved_basedir */ if (expand_filepath(local_open_basedir, resolved_basedir) != NULL) { - int basedir_len = (int)strlen(basedir); + size_t basedir_len = strlen(basedir); /* Handler for basedirs that end with a / */ - resolved_basedir_len = (int)strlen(resolved_basedir); + resolved_basedir_len = strlen(resolved_basedir); #ifdef PHP_WIN32 if (basedir[basedir_len - 1] == PHP_DIR_SEPARATOR || basedir[basedir_len - 1] == '/') { #else @@ -231,7 +231,7 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path resolved_basedir[resolved_basedir_len] = '\0'; } - resolved_name_len = (int)strlen(resolved_name); + resolved_name_len = strlen(resolved_name); if (path_tmp[path_len - 1] == PHP_DIR_SEPARATOR) { if (resolved_name[resolved_name_len - 1] != PHP_DIR_SEPARATOR) { resolved_name[resolved_name_len] = PHP_DIR_SEPARATOR; diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index b3c4d7f3ab8..5e1544c513e 100644 --- a/main/fopen_wrappers.h +++ b/main/fopen_wrappers.h @@ -54,4 +54,6 @@ END_EXTERN_C() * tab-width: 4 * c-basic-offset: 4 * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 */ diff --git a/main/http_status_codes.h b/main/http_status_codes.h index 64306bdacbf..a8417b6b89e 100644 --- a/main/http_status_codes.h +++ b/main/http_status_codes.h @@ -82,3 +82,11 @@ static http_response_status_code_pair http_status_map[] = { static const size_t http_status_map_len = (sizeof(http_status_map) / sizeof(http_response_status_code_pair)) - 1; #endif /* HTTP_STATUS_CODES_H */ +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_compat.h b/main/php_compat.h index 7c05022212f..f0b872dad02 100644 --- a/main/php_compat.h +++ b/main/php_compat.h @@ -376,3 +376,11 @@ #endif #endif +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_content_types.h b/main/php_content_types.h index 6b5387f46c6..cd01fe8181d 100644 --- a/main/php_content_types.h +++ b/main/php_content_types.h @@ -29,3 +29,11 @@ int php_startup_sapi_content_types(void); int php_setup_sapi_content_types(void); #endif /* PHP_CONTENT_TYPES_H */ +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_globals.h b/main/php_globals.h index e039f32f236..d27f397da9b 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -176,4 +176,6 @@ struct _php_core_globals { * tab-width: 4 * c-basic-offset: 4 * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 */ diff --git a/main/php_ini.h b/main/php_ini.h index 2ae90fe8427..e582deff658 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -89,3 +89,11 @@ END_EXTERN_C() #define php_ini_string zend_ini_string #endif /* PHP_INI_H */ +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_main.h b/main/php_main.h index 29650487375..ff342a1f38c 100644 --- a/main/php_main.h +++ b/main/php_main.h @@ -56,3 +56,11 @@ extern int php_shutdown_environ(void); END_EXTERN_C() #endif +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_network.h b/main/php_network.h index 5385fe13d46..ee02fd19fd0 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -344,7 +344,9 @@ END_EXTERN_C() /* * Local variables: - * tab-width: 8 - * c-basic-offset: 8 + * tab-width: 4 + * c-basic-offset: 4 * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 */ diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index 50107f6bb84..f2303882f4b 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -114,7 +114,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, zend_st } #ifdef PHP_WIN32 - if (!php_win32_check_trailing_space(pfx, (const int)strlen(pfx))) { + if (!php_win32_check_trailing_space(pfx, strlen(pfx))) { SetLastError(ERROR_INVALID_NAME); return -1; } diff --git a/main/php_open_temporary_file.h b/main/php_open_temporary_file.h index 0a9b2571507..fbafb333ed3 100644 --- a/main/php_open_temporary_file.h +++ b/main/php_open_temporary_file.h @@ -32,3 +32,11 @@ PHPAPI const char *php_get_temporary_directory(void); END_EXTERN_C() #endif /* PHP_OPEN_TEMPORARY_FILE_H */ +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h index 86f402d6cc3..f66f3c5e3ac 100644 --- a/main/php_reentrancy.h +++ b/main/php_reentrancy.h @@ -131,3 +131,11 @@ void reentrancy_shutdown(void); #endif #endif +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_scandir.h b/main/php_scandir.h index 3e67e748208..2e8773b8b18 100644 --- a/main/php_scandir.h +++ b/main/php_scandir.h @@ -52,3 +52,11 @@ PHPAPI int php_alphasort(const struct dirent **a, const struct dirent **b); #endif #endif /* PHP_SCANDIR_H */ +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_syslog.h b/main/php_syslog.h index 33f52a336f4..be68cc499a8 100644 --- a/main/php_syslog.h +++ b/main/php_syslog.h @@ -50,3 +50,11 @@ #endif #endif +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_ticks.h b/main/php_ticks.h index b807b3e9efc..5df885473d1 100644 --- a/main/php_ticks.h +++ b/main/php_ticks.h @@ -38,4 +38,6 @@ END_EXTERN_C() * tab-width: 4 * c-basic-offset: 4 * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 */ diff --git a/main/php_variables.h b/main/php_variables.h index af7254b0208..5fa38fa00be 100644 --- a/main/php_variables.h +++ b/main/php_variables.h @@ -48,3 +48,11 @@ END_EXTERN_C() #define NUM_TRACK_VARS 6 #endif /* PHP_VARIABLES_H */ +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/rfc1867.h b/main/rfc1867.h index 637c3253097..5dc7926db2f 100644 --- a/main/rfc1867.h +++ b/main/rfc1867.h @@ -89,3 +89,11 @@ SAPI_API void php_rfc1867_set_multibyte_callbacks( php_rfc1867_basename_t basename); #endif /* RFC1867_H */ +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/snprintf.h b/main/snprintf.h index 7abf55643e5..021629681d9 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -178,4 +178,6 @@ PHPAPI char * ap_php_conv_p2(u_wide_int num, int nbits, * tab-width: 4 * c-basic-offset: 4 * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 */ diff --git a/main/spprintf.h b/main/spprintf.h index 89f23f19aae..597d95b0926 100644 --- a/main/spprintf.h +++ b/main/spprintf.h @@ -40,4 +40,6 @@ END_EXTERN_C() * tab-width: 4 * c-basic-offset: 4 * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 */ diff --git a/main/streams/memory.c b/main/streams/memory.c index d41b2f5cfac..7af87c7efbc 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -618,10 +618,10 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con php_stream *stream; php_stream_temp_data *ts; char *comma, *semi, *sep, *key; - size_t mlen, dlen, plen, vlen; + size_t mlen, dlen, plen, vlen, ilen; zend_off_t newoffs; zval meta; - int base64 = 0, ilen; + int base64 = 0; zend_string *base64_comma = NULL; ZVAL_NULL(&meta); @@ -720,11 +720,11 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con return NULL; } comma = ZSTR_VAL(base64_comma); - ilen = (int)ZSTR_LEN(base64_comma); + ilen = ZSTR_LEN(base64_comma); } else { comma = estrndup(comma, dlen); dlen = php_url_decode(comma, dlen); - ilen = (int)dlen; + ilen = dlen; } if ((stream = php_stream_temp_create_rel(0, ~0u)) != NULL) { diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 537021abd63..7e1894138f8 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -1139,11 +1139,11 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f } #ifdef PHP_WIN32 - if (!php_win32_check_trailing_space(url_from, (int)strlen(url_from))) { + if (!php_win32_check_trailing_space(url_from, strlen(url_from))) { php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to); return 0; } - if (!php_win32_check_trailing_space(url_to, (int)strlen(url_to))) { + if (!php_win32_check_trailing_space(url_to, strlen(url_to))) { php_win32_docref2_from_error(ERROR_INVALID_NAME, url_from, url_to); return 0; } @@ -1311,7 +1311,7 @@ static int php_plain_files_rmdir(php_stream_wrapper *wrapper, const char *url, i } #ifdef PHP_WIN32 - if (!php_win32_check_trailing_space(url, (int)strlen(url))) { + if (!php_win32_check_trailing_space(url, strlen(url))) { php_error_docref1(NULL, url, E_WARNING, "%s", strerror(ENOENT)); return 0; } @@ -1337,12 +1337,9 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url #endif mode_t mode; int ret = 0; -#ifdef PHP_WIN32 - int url_len = (int)strlen(url); -#endif #ifdef PHP_WIN32 - if (!php_win32_check_trailing_space(url, url_len)) { + if (!php_win32_check_trailing_space(url, strlen(url))) { php_error_docref1(NULL, url, E_WARNING, "%s", strerror(ENOENT)); return 0; } diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 3b45d6507fb..e47aa0d5c6c 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -1691,7 +1691,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) MFO.WriteLine("\t@$(CC) $(" + flags + ") $(CFLAGS) $(" + bd_flags_name + ") /c " + dir + "\\" + src + " /Fo" + sub_build + d + obj); if ("clang" == PHP_ANALYZER) { - MFO.WriteLine("\t\"@$(CLANG_CL)\" " + analyzer_base_args + " $(" + flags + "_ANALYZER) $(CFLAGS_ANALYZER) $(" + bd_flags_name + "_ANALYZER) " + dir + "\\" + src); + MFO.WriteLine("\t@\"$(CLANG_CL)\" " + analyzer_base_args + " $(" + flags + "_ANALYZER) $(CFLAGS_ANALYZER) $(" + bd_flags_name + "_ANALYZER) " + dir + "\\" + src); } else if ("cppcheck" == PHP_ANALYZER) { MFO.WriteLine("\t\"@$(CPPCHECK)\" " + analyzer_base_args + " $(" + flags + "_ANALYZER) $(CFLAGS_ANALYZER) $(" + bd_flags_name + "_ANALYZER) " + analyzer_base_flags + " " + dir + "\\" + src); }else if (PHP_ANALYZER == "pvs") { diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt index cb71dd8f35b..46851faf738 100644 --- a/win32/build/libs_version.txt +++ b/win32/build/libs_version.txt @@ -1,9 +1,9 @@ bz2-1.0.6 cclient-2007f -freetype-2.7.0 +freetype-2.8.0 icu-57.1 jpeglib-9b -libcurl-7.54.0 +libcurl-7.54.1 libiconv-1.15 libmpir-3.0.0 libpng-1.6.29 diff --git a/win32/ioutil.c b/win32/ioutil.c index 9c0601af97c..aa56b94ee7b 100644 --- a/win32/ioutil.c +++ b/win32/ioutil.c @@ -395,14 +395,15 @@ PW32IO int php_win32_ioutil_rename_w(const wchar_t *oldname, const wchar_t *newn return ret; }/*}}}*/ -PW32IO wchar_t *php_win32_ioutil_getcwd_w(const wchar_t *buf, int len) +PW32IO wchar_t *php_win32_ioutil_getcwd_w(wchar_t *buf, size_t len) {/*{{{*/ DWORD err = 0; wchar_t *tmp_buf = NULL; + DWORD tmp_len = (DWORD)len; /* If buf was NULL, the result has to be freed outside here. */ if (!buf) { - DWORD tmp_len = GetCurrentDirectoryW(0, NULL) + 1; + tmp_len = GetCurrentDirectoryW(0, NULL) + 1; if (!tmp_len) { err = GetLastError(); SET_ERRNO_FROM_WIN32_CODE(err); @@ -412,9 +413,7 @@ PW32IO wchar_t *php_win32_ioutil_getcwd_w(const wchar_t *buf, int len) return NULL; } - len = tmp_len; - - tmp_buf = (wchar_t *)malloc((len)*sizeof(wchar_t)); + tmp_buf = (wchar_t *)malloc((tmp_len)*sizeof(wchar_t)); if (!tmp_buf) { SET_ERRNO_FROM_WIN32_CODE(ERROR_NOT_ENOUGH_MEMORY); return NULL; @@ -422,7 +421,7 @@ PW32IO wchar_t *php_win32_ioutil_getcwd_w(const wchar_t *buf, int len) buf = tmp_buf; } - if (!GetCurrentDirectoryW(len, buf)) { + if (!GetCurrentDirectoryW(tmp_len, buf)) { err = GetLastError(); SET_ERRNO_FROM_WIN32_CODE(err); free(tmp_buf); @@ -522,7 +521,7 @@ PW32IO php_win32_ioutil_normalization_result php_win32_ioutil_normalize_path_w(w return PHP_WIN32_IOUTIL_NORM_FAIL; } - while (NULL != (pos = wcschr(idx, PHP_WIN32_IOUTIL_FW_SLASHW)) && idx - *buf <= len) { + while (NULL != (pos = wcschr(idx, PHP_WIN32_IOUTIL_FW_SLASHW)) && (size_t)(idx - *buf) <= len) { *pos = PHP_WIN32_IOUTIL_DEFAULT_SLASHW; idx = pos++; } diff --git a/win32/ioutil.h b/win32/ioutil.h index 9e0c1ce15ca..99877446266 100644 --- a/win32/ioutil.h +++ b/win32/ioutil.h @@ -137,7 +137,7 @@ typedef enum { #define PHP_WIN32_IOUTIL_CHECK_PATH_W(pathw, ret, dealloc) do { \ if (!PHP_WIN32_IOUTIL_PATH_IS_OK_W(pathw, wcslen(pathw))) { \ if (dealloc) { \ - free(pathw); \ + free((void *)pathw); \ } \ SET_ERRNO_FROM_WIN32_CODE(ERROR_ACCESS_DENIED); \ return ret; \ @@ -222,7 +222,7 @@ PW32IO size_t php_win32_ioutil_dirname(char *buf, size_t len); PW32IO int php_win32_ioutil_open_w(const wchar_t *path, int flags, ...); PW32IO int php_win32_ioutil_chdir_w(const wchar_t *path); PW32IO int php_win32_ioutil_rename_w(const wchar_t *oldname, const wchar_t *newname); -PW32IO wchar_t *php_win32_ioutil_getcwd_w(const wchar_t *buf, int len); +PW32IO wchar_t *php_win32_ioutil_getcwd_w(wchar_t *buf, size_t len); #if 0 PW32IO int php_win32_ioutil_mkdir_w(const wchar_t *path, mode_t mode); diff --git a/win32/winutil.c b/win32/winutil.c index 2852a19e304..34dda95498f 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -36,9 +36,9 @@ PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error) return (buf ? (char *) buf : ""); }/*}}}*/ -int php_win32_check_trailing_space(const char * path, const int path_len) +int php_win32_check_trailing_space(const char * path, const size_t path_len) {/*{{{*/ - if (path_len < 1) { + if (path_len > MAXPATHLEN - 1) { return 1; } if (path) { diff --git a/win32/winutil.h b/win32/winutil.h index d4d3700f206..a08cdbef5a7 100644 --- a/win32/winutil.h +++ b/win32/winutil.h @@ -28,7 +28,7 @@ PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error); #define php_win_err() php_win32_error_to_msg(GetLastError()) -int php_win32_check_trailing_space(const char * path, const int path_len); +int php_win32_check_trailing_space(const char * path, const size_t path_len); PHP_WINUTIL_API int php_win32_get_random_bytes(unsigned char *buf, size_t size); #ifdef PHP_EXPORTS BOOL php_win32_init_random_bytes(void);