diff options
author | Stanislav Malyshev <stas@php.net> | 2013-12-08 15:37:35 -0800 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2013-12-16 11:34:24 -0800 |
commit | cbcf6e1880e35ed7cd052e127b037eee7cef61c9 (patch) | |
tree | 29d04b75516454946ac84f26134c9eee67952ee5 /ext/exif | |
parent | 68a73ce3c449622f729bae257d1ed42e54a1a839 (diff) | |
download | php-git-cbcf6e1880e35ed7cd052e127b037eee7cef61c9.tar.gz |
Fix bug #65873 - Integer overflow in exif_read_data()
Diffstat (limited to 'ext/exif')
-rw-r--r-- | ext/exif/exif.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 2fe54f7b31..c531d8dfa8 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -2852,7 +2852,12 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); /* If its bigger than 4 bytes, the dir entry contains an offset. */ value_ptr = offset_base+offset_val; - if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry) { + /* + dir_entry is ImageInfo->file.list[sn].data+2+i*12 + 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)) { /* 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. */ |