Skip to content

Commit 5621c5f

Browse files
committed
Fix #79687: Sony picture - PHP Warning - Make, Model, MakerNotes
Even if the length of a maker note does not match our expectations (either because the maker note is corrupted, or because our expectations do not quite match reality), there is no need to let parsing fail; we can still go on parsing the other meta information.
1 parent 86e1f0e commit 5621c5f

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ PHP NEWS
88
Nikita)
99
. Fixed possibly unsupported timercmp() usage. (cmb)
1010

11+
- Exif:
12+
. Fixed bug #79687 (Sony picture - PHP Warning - Make, Model, MakerNotes).
13+
(cmb)
14+
1115
- Filter:
1216
. Fixed bug #73527 (Invalid memory access in php_filter_strip). (cmb)
1317

ext/exif/exif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3147,7 +3147,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
31473147
if (value_len < 2 || maker_note->offset >= value_len - 1) {
31483148
/* Do not go past the value end */
31493149
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);
3150-
return FALSE;
3150+
return TRUE;
31513151
}
31523152

31533153
dir_start = value_ptr + maker_note->offset;

ext/exif/tests/bug77563.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ DONE
1010
--EXPECTF--
1111
Warning: exif_thumbnail(bug77563.jpg): IFD data too short: 0x0009 offset 0x0008 in %s%ebug77563.php on line %d
1212

13+
Warning: exif_thumbnail(bug77563.jpg): Illegal IFD offset in %s%ebug77563.php on line %d
14+
1315
Warning: exif_thumbnail(bug77563.jpg): File structure corrupted in %s%ebug77563.php on line %d
1416

1517
Warning: exif_thumbnail(bug77563.jpg): Invalid JPEG file in %s%ebug77563.php on line %d

ext/exif/tests/bug78910.phpt

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,32 @@ Warning: exif_read_data(): Process tag(x927C=MakerNote ): Illegal format code 0
1313

1414
Warning: exif_read_data(): IFD data too short: 0x0000 offset 0x000C in %s on line %d
1515

16-
Warning: exif_read_data(): Invalid TIFF file in %s on line %d
17-
bool(false)
16+
Warning: exif_read_data(): Error in TIFF: filesize(x002A) less than start of IFD dir(x46494C4F) in %s on line %d
17+
array(8) {
18+
["FileDateTime"]=>
19+
int(0)
20+
["FileSize"]=>
21+
int(42)
22+
["FileType"]=>
23+
int(8)
24+
["MimeType"]=>
25+
string(10) "image/tiff"
26+
["SectionsFound"]=>
27+
string(13) "ANY_TAG, IFD0"
28+
["COMPUTED"]=>
29+
array(2) {
30+
["IsColor"]=>
31+
int(0)
32+
["ByteOrderMotorola"]=>
33+
int(1)
34+
}
35+
["Make"]=>
36+
array(2) {
37+
[0]=>
38+
int(1179994697)
39+
[1]=>
40+
int(1179208781)
41+
}
42+
["MakerNote"]=>
43+
NULL
44+
}

0 commit comments

Comments
 (0)