summaryrefslogtreecommitdiff
path: root/ext/exif/exif.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2011-11-19 04:49:36 +0000
committerStanislav Malyshev <stas@php.net>2011-11-19 04:49:36 +0000
commit1dfbe61e2adfa3dab9896e7fd0c87938e53629e2 (patch)
tree6650758cc13cb9b55b5cd1402ddd1906bae5d91e /ext/exif/exif.c
parent57de041b142f6a5b612b3c6191d8d262720efc61 (diff)
downloadphp-git-1dfbe61e2adfa3dab9896e7fd0c87938e53629e2.tar.gz
fix bug #60150 for 5.3 too
Diffstat (limited to 'ext/exif/exif.c')
-rw-r--r--ext/exif/exif.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index bb805302cd..f1c40361ea 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -2874,11 +2874,11 @@ 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 (offset_val+byte_count > IFDlength || value_ptr < dir_entry) {
+ if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry) {
/* 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. */
- if (offset_val+byte_count>ImageInfo->FileSize || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) {
+ if (byte_count > ImageInfo->FileSize || offset_val>ImageInfo->FileSize-byte_count || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) {
if (value_ptr < dir_entry) {
/* we can read this if offset_val > 0 */
/* some files have their values in other parts of the file */