Skip to content

Commit 57408f9

Browse files
committed
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fix bug #65873 - Integer overflow in exif_read_data()
2 parents a67c615 + cbcf6e1 commit 57408f9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ PHP NEWS
2121
. Fixed bug #65196 (Passing DOMDocumentFragment to DOMDocument::saveHTML()
2222
Produces invalid Markup). (Mike)
2323

24+
- Exif:
25+
. Fixed bug #65873 (Integer overflow in exif_read_data()). (Stas)
26+
2427
- Filter:
2528
. Fixed bug #66229 (128.0.0.0/16 isn't reserved any longer). (Adam)
2629

ext/exif/exif.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,12 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
28522852
offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
28532853
/* If its bigger than 4 bytes, the dir entry contains an offset. */
28542854
value_ptr = offset_base+offset_val;
2855-
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry) {
2855+
/*
2856+
dir_entry is ImageInfo->file.list[sn].data+2+i*12
2857+
offset_base is ImageInfo->file.list[sn].data-dir_offset
2858+
dir_entry - offset_base is dir_offset+2+i*12
2859+
*/
2860+
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
28562861
/* It is important to check for IMAGE_FILETYPE_TIFF
28572862
* JPEG does not use absolute pointers instead its pointers are
28582863
* relative to the start of the TIFF header in APP1 section. */

0 commit comments

Comments
 (0)