Skip to content

Commit f0b7bb8

Browse files
committed
Merge branch 'master' into sccp
* master: (37 commits) #73594 tests only check the extra params if dns_get_record is successful Fixed bug #74852 (property_exists returns true on unknown DateInterval property) fix uninitialized var fix comparison warning comply with POSIX signature fix warning remove some casts cleanup casts remove useless cast eliminate casts sync vim mode lines in main [ci skip] update NEWS [ci skip] update NEWS [ci skip] update NEWS Fixed bug #74883 SQLite3::__construct() produces "out of memory" exception with invalid flags Silent compiler warning Fix test Deprecated the read_exif_data() alias Add myself as exif maintainer update libs versions ...
2 parents e69d4f6 + cfacf84 commit f0b7bb8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+341
-73
lines changed

EXTENSIONS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ STATUS: Working
269269
SINCE: 5.3
270270
-------------------------------------------------------------------------------
271271
EXTENSION: exif
272-
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
272+
PRIMARY MAINTAINER: Kalle Sommer Nielsen <kalle@php.net>
273273
MAINTENANCE: Maintained
274274
STATUS: Working
275275
SINCE: 4.2

NEWS

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ PHP NEWS
99
unserialize). (Nikita)
1010
. Fixed bug #74819 (wddx_deserialize() heap out-of-bound read via
1111
php_parse_date()). (Derick)
12+
. Fixed bug #74878 (Data race in ZTS builds). (Nikita)
13+
14+
- Date:
15+
. Fixed bug #74852 (property_exists returns true on unknown DateInterval
16+
property). (jhdxr)
17+
18+
- EXIF:
19+
. Deprecated the read_exif_data() alias. (Kalle)
20+
. Fixed bug #74428 (exif_read_data(): "Illegal IFD size" warning occurs with
21+
correct exif format). (bradpiccho at gmail dot com, Kalle)
22+
. Fixed bug #72819 (EXIF thumbnails not read anymore). (Kalle)
23+
. Fixed bug #62523 (php crashes with segfault when exif_read_data called).
24+
(Kalle)
25+
. Fixed bug #50660 (exif_read_data(): Illegal IFD offset (works fine with
26+
other exif readers). (skinny dot bravo at gmail dot com, Kalle)
1227

1328
- GD:
1429
. Fixed bug #74435 (Buffer over-read into uninitialized memory). (cmb)
@@ -25,6 +40,10 @@ PHP NEWS
2540
. Fixed bug #74873 (Minor BC break: PCRE_JIT changes output of preg_match()).
2641
(Dmitry)
2742

43+
- SQLite3:
44+
. Fixed bug #74883 (SQLite3::__construct() produces "out of memory" exception
45+
with invalid flags). (Anatol)
46+
2847
06 Jul 2017, PHP 7.2.0alpha3
2948

3049
- Core:
@@ -229,6 +248,8 @@ PHP NEWS
229248
. Fixed bug #73961 (environmental build dependency in hash sha3 source).
230249
(krakjoe)
231250
. Changed HashContext from resource to object. (Rouven Weßling, Sara)
251+
. Disallowed usage of non-cryptographic hash functions with HMAC and PBKDF2.
252+
(Andrey Andreev, Nikita)
232253

233254
- intl:
234255
. Fixed bug #74433 (wrong reflection for Normalizer methods). (villfa)

UPGRADING

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ PHP 7.2 UPGRADE NOTES
4949
example `bcmod('4', '3.5')` now returns '0.5' instead of '1'.
5050

5151
- Hash:
52-
. The hash_hmac(), hash_hmac_file() and hash_pbkdf2() functions no longer
53-
accept non-cryptographic hashes.
52+
. The hash_hmac(), hash_hmac_file(), hash_pbkdf2() and hash_init() (with
53+
HASH_HMAC) functions no longer accept non-cryptographic hashes.
5454

5555
- JSON
5656
. The json_decode() option JSON_OBJECT_AS_ARRAY is used if the second
@@ -164,6 +164,9 @@ PHP 8.0.
164164
. The create_function() function has been deprecated, use anonymous functions
165165
instead.
166166
. The each() function has been deprecated, use a foreach loop instead.
167+
168+
- EXIF:
169+
. The read_exif_data() alias have been deprecated, use exif_read_data() instead.
167170

168171
- GD:
169172
. png2wbmp() and jpeg2wbmp() have been deprecated.

Zend/zend_API.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3742,6 +3742,10 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
37423742
break;
37433743
}
37443744
}
3745+
3746+
/* Must be interned to avoid ZTS data races */
3747+
name = zend_new_interned_string(zend_string_copy(name));
3748+
37453749
if (access_type & ZEND_ACC_PUBLIC) {
37463750
property_info->name = zend_string_copy(name);
37473751
} else if (access_type & ZEND_ACC_PRIVATE) {

ext/date/php_date.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void
20162016
zval *prop;
20172017
int retval = 0;
20182018

2019-
if (Z_TYPE_P(member) != IS_STRING) {
2019+
if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
20202020
ZVAL_COPY(&tmp_member, member);
20212021
convert_to_string(&tmp_member);
20222022
member = &tmp_member;
@@ -2032,10 +2032,10 @@ static int date_interval_has_property(zval *object, zval *member, int type, void
20322032
}
20332033
return retval;
20342034
}
2035-
2036-
prop = date_interval_read_property(object, member, type, cache_slot, &rv);
2037-
2038-
if (prop != NULL) {
2035+
2036+
prop = date_interval_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
2037+
2038+
if (prop != &EG(uninitialized_zval)) {
20392039
if (type == 2) {
20402040
retval = 1;
20412041
} else if (type == 1) {

ext/date/tests/bug74852.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #74852 property_exists returns true on unknown DateInterval property
3+
--FILE--
4+
<?php
5+
6+
$interval = new DateInterval('P2D');
7+
var_dump(property_exists($interval,'abcde'));
8+
var_dump(isset($interval->abcde));
9+
var_dump($interval->abcde);
10+
11+
?>
12+
--EXPECTF--
13+
bool(false)
14+
bool(false)
15+
16+
Notice: Undefined property: DateInterval::$abcde in %s on line %d
17+
NULL

ext/exif/exif.c

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ ZEND_END_ARG_INFO()
120120
*/
121121
const zend_function_entry exif_functions[] = {
122122
PHP_FE(exif_read_data, arginfo_exif_read_data)
123-
PHP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data)
123+
PHP_DEP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data)
124124
PHP_FE(exif_tagname, arginfo_exif_tagname)
125125
PHP_FE(exif_thumbnail, arginfo_exif_thumbnail)
126126
PHP_FE(exif_imagetype, arginfo_exif_imagetype)
@@ -1340,8 +1340,10 @@ typedef enum mn_byte_order_t {
13401340

13411341
typedef enum mn_offset_mode_t {
13421342
MN_OFFSET_NORMAL,
1343-
MN_OFFSET_MAKER,
1344-
MN_OFFSET_GUESS
1343+
MN_OFFSET_MAKER
1344+
#ifdef KALLE_0
1345+
, MN_OFFSET_GUESS
1346+
#endif
13451347
} mn_offset_mode_t;
13461348

13471349
typedef struct {
@@ -1357,7 +1359,7 @@ typedef struct {
13571359

13581360
/* Remember to update PHP_MINFO if updated */
13591361
static const maker_note_type maker_note_array[] = {
1360-
{ tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_INTEL, MN_OFFSET_GUESS},
1362+
{ tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_INTEL, MN_OFFSET_NORMAL},
13611363
{ tag_table_VND_CASIO, "CASIO", NULL, NULL, 0, 0, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL},
13621364
{ tag_table_VND_FUJI, "FUJIFILM", NULL, "FUJIFILM\x0C\x00\x00\x00", 12, 12, MN_ORDER_INTEL, MN_OFFSET_MAKER},
13631365
{ 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)
26772679
/* }}} */
26782680

26792681
/* forward declarations */
2680-
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);
2682+
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);
26812683
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);
26822684

26832685
/* {{{ exif_get_markername
@@ -3118,7 +3120,10 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
31183120
{
31193121
size_t i;
31203122
int de, section_index = SECTION_MAKERNOTE;
3121-
int NumDirEntries, old_motorola_intel, offset_diff;
3123+
int NumDirEntries, old_motorola_intel;
3124+
#ifdef KALLE_0
3125+
int offset_diff;
3126+
#endif
31223127
const maker_note_type *maker_note;
31233128
char *dir_start;
31243129

@@ -3176,6 +3181,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
31763181
case MN_OFFSET_MAKER:
31773182
offset_base = value_ptr;
31783183
break;
3184+
#ifdef KALLE_0
31793185
case MN_OFFSET_GUESS:
31803186
if (maker_note->offset + 10 + 4 >= value_len) {
31813187
/* 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
31923198
}
31933199
offset_base = value_ptr + offset_diff;
31943200
break;
3201+
#endif
31953202
default:
31963203
case MN_OFFSET_NORMAL:
31973204
break;
@@ -3524,7 +3531,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
35243531
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD Pointer");
35253532
return FALSE;
35263533
}
3527-
if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index)) {
3534+
if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index, tag)) {
35283535
return FALSE;
35293536
}
35303537
#ifdef EXIF_DEBUG
@@ -3541,19 +3548,19 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
35413548

35423549
/* {{{ exif_process_IFD_in_JPEG
35433550
* Process one of the nested IFDs directories. */
3544-
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)
3551+
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)
35453552
{
35463553
int de;
35473554
int NumDirEntries;
3548-
int NextDirOffset;
3555+
int NextDirOffset = 0;
35493556

35503557
#ifdef EXIF_DEBUG
35513558
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process %s (x%04X(=%d))", exif_get_sectionname(section_index), IFDlength, IFDlength);
35523559
#endif
35533560

35543561
ImageInfo->sections_found |= FOUND_IFD0;
35553562

3556-
if ((dir_start + 2) >= (offset_base+IFDlength)) {
3563+
if ((dir_start + 2) > (offset_base+IFDlength)) {
35573564
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
35583565
return FALSE;
35593566
}
@@ -3581,11 +3588,15 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
35813588
* Hack to make it process IDF1 I hope
35823589
* There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail
35833590
*/
3584-
if ((dir_start+2+12*de + 4) >= (offset_base+IFDlength)) {
3591+
if ((dir_start+2+12*de + 4) > (offset_base+IFDlength)) {
35853592
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
35863593
return FALSE;
35873594
}
3588-
NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
3595+
3596+
if (tag != TAG_EXIF_IFD_POINTER && tag != TAG_GPS_IFD_POINTER) {
3597+
NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
3598+
}
3599+
35893600
if (NextDirOffset) {
35903601
/* the next line seems false but here IFDlength means length of all IFDs */
35913602
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,
35963607
#ifdef EXIF_DEBUG
35973608
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Expect next IFD to be thumbnail");
35983609
#endif
3599-
if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displacement, SECTION_THUMBNAIL)) {
3610+
if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displacement, SECTION_THUMBNAIL, 0)) {
36003611
#ifdef EXIF_DEBUG
36013612
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail size: 0x%04X", ImageInfo->Thumbnail.size);
36023613
#endif
@@ -3651,7 +3662,7 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf,
36513662

36523663
ImageInfo->sections_found |= FOUND_IFD0;
36533664
/* First directory starts at offset 8. Offsets starts at 0. */
3654-
exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, SECTION_IFD0);
3665+
exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, SECTION_IFD0, 0);
36553666

36563667
#ifdef EXIF_DEBUG
36573668
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process TIFF in JPEG done");
860 KB
Loading
917 KB
Loading

ext/exif/tests/bug50660/bug50660.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Bug #50660 (exif_read_data(): Illegal IFD offset (works fine with other exif readers))
3+
--SKIPIF--
4+
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
5+
--INI--
6+
output_handler=
7+
zlib.output_compression=0
8+
--FILE--
9+
<?php
10+
$infile = dirname(__FILE__).'/bug50660-1.jpg';
11+
var_dump(exif_read_data($infile) !== false);
12+
$infile = dirname(__FILE__).'/bug50660-2.jpg';
13+
var_dump(exif_read_data($infile) !== false);
14+
?>
15+
===DONE===
16+
--EXPECT--
17+
bool(true)
18+
bool(true)
19+
===DONE===

ext/exif/tests/bug62523_1.jpg

71.6 KB
Loading

ext/exif/tests/bug62523_1.phpt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ extension_loaded("exif") or die("skip need exif");
77
--FILE--
88
<?php
99
echo "Test\n";
10-
var_dump(exif_read_data(__DIR__."/bug62523_1.jpg"));
10+
var_dump(count(exif_read_data(__DIR__."/bug62523_1.jpg")));
1111
?>
1212
Done
13-
--EXPECTF--
13+
--EXPECT--
1414
Test
15-
16-
Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d
17-
bool(false)
15+
int(86)
1816
Done

ext/exif/tests/bug62523_2.phpt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ echo "Test\n";
1010
var_dump(count(exif_read_data(__DIR__."/bug62523_2.jpg")));
1111
?>
1212
Done
13-
--EXPECTF--
13+
--EXPECT--
1414
Test
15-
16-
Warning: exif_read_data(bug62523_2.jpg): IFD data bad offset: 0xADB23672 length 0x0D94 in %s%ebug62523_2.php on line %d
17-
int(30)
15+
int(76)
1816
Done

ext/exif/tests/bug72819/bug72819.jpg

32 KB
Loading

ext/exif/tests/bug72819/bug72819.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #72819 (EXIF thumbnails not read anymore)
3+
--SKIPIF--
4+
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
5+
--INI--
6+
output_handler=
7+
zlib.output_compression=0
8+
--FILE--
9+
<?php
10+
$infile = dirname(__FILE__).'/bug72819.jpg';
11+
var_dump(strlen(exif_thumbnail($infile)));
12+
?>
13+
===DONE===
14+
--EXPECT--
15+
int(5448)
16+
===DONE===

ext/exif/tests/bug73115/bug73115.JPG

4.71 MB
Loading

ext/exif/tests/bug73115/bug73115.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #73115 (exif_read_data triggers warning on reading binary strings)
3+
--SKIPIF--
4+
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
5+
--INI--
6+
output_handler=
7+
zlib.output_compression=0
8+
--FILE--
9+
<?php
10+
$infile = dirname(__FILE__).'/bug73115.JPG';
11+
var_dump(count(exif_read_data($infile)));
12+
?>
13+
===DONE===
14+
--EXPECT--
15+
int(80)
16+
===DONE===

ext/exif/tests/bug74428/bug74428.jpg

1.86 KB
Loading

ext/exif/tests/bug74428/bug74428.phpt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
--TEST--
2+
Bug #74428 (exif_read_data(): "Illegal IFD size" warning occurs with correct exif format)
3+
--SKIPIF--
4+
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
5+
--INI--
6+
output_handler=
7+
zlib.output_compression=0
8+
--FILE--
9+
<?php
10+
$infile = dirname(__FILE__).'/bug74428.jpg';
11+
var_dump(exif_read_data($infile));
12+
?>
13+
===DONE===
14+
--EXPECTF--
15+
array(11) {
16+
["FileName"]=>
17+
string(12) "bug74428.jpg"
18+
["FileDateTime"]=>
19+
int(%d)
20+
["FileSize"]=>
21+
int(1902)
22+
["FileType"]=>
23+
int(2)
24+
["MimeType"]=>
25+
string(10) "image/jpeg"
26+
["SectionsFound"]=>
27+
string(19) "ANY_TAG, IFD0, EXIF"
28+
["COMPUTED"]=>
29+
array(5) {
30+
["html"]=>
31+
string(22) "width="88" height="28""
32+
["Height"]=>
33+
int(28)
34+
["Width"]=>
35+
int(88)
36+
["IsColor"]=>
37+
int(1)
38+
["ByteOrderMotorola"]=>
39+
int(0)
40+
}
41+
["Orientation"]=>
42+
int(1)
43+
["Exif_IFD_Pointer"]=>
44+
int(38)
45+
["ExifImageWidth"]=>
46+
int(88)
47+
["ExifImageLength"]=>
48+
int(28)
49+
}
50+
===DONE===

0 commit comments

Comments
 (0)