]>
Commit | Line | Data |
---|---|---|
82f6b657 ER |
1 | diff -up php-5.2.17/ext/exif/exif.c.CVE-2011-4566 php-5.2.17/ext/exif/exif.c |
2 | --- php-5.2.17/ext/exif/exif.c.CVE-2011-4566 2012-01-11 15:00:23.000000000 +0700 | |
3 | +++ php-5.2.17/ext/exif/exif.c 2012-01-11 15:02:25.000000000 +0700 | |
4 | @@ -2873,11 +2873,11 @@ static int exif_process_IFD_TAG(image_in | |
5 | offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); | |
6 | /* If its bigger than 4 bytes, the dir entry contains an offset. */ | |
7 | value_ptr = offset_base+offset_val; | |
8 | - if (offset_val+byte_count > IFDlength || value_ptr < dir_entry) { | |
9 | + if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry) { | |
10 | /* It is important to check for IMAGE_FILETYPE_TIFF | |
11 | * JPEG does not use absolute pointers instead its pointers are | |
12 | * relative to the start of the TIFF header in APP1 section. */ | |
13 | - if (offset_val+byte_count>ImageInfo->FileSize || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) { | |
14 | + 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)) { | |
15 | if (value_ptr < dir_entry) { | |
16 | /* we can read this if offset_val > 0 */ | |
17 | /* some files have their values in other parts of the file */ |