com php-src: Further fix bug #72627 from Stas: ext/exif/exif.c
| From: | Kalle Sommer Nielsen | Date: | Wed, 17 Aug 2016 18:51:50 +0000 |
| Subject: | com php-src: Further fix bug #72627 from Stas: ext/exif/exif.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93919@lists.php.net to get a copy of this message | ||
Commit: 15b7b1a5107f385cbd3551f6c6b5d7149c3adf19
Author: Kalle Sommer Nielsen <kalle@php.net> Wed, 17 Aug 2016 20:51:50 +0200
Parents: 1bc9ea4f10ddeb4bc56e73a21541e38a7b8ab5a7
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=15b7b1a5107f385cbd3551f6c6b5d7149c3adf19
Log:
Further fix bug #72627 from Stas
There is another code path with almost the same identical code that also leaks memory in case of
invalid reads, fix this as well
Bugs:
https://bugs.php.net/72627
Changed paths:
M ext/exif/exif.c
Diff:
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index f0c631e..d6acf91 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -3723,8 +3723,12 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t
dir_offse
fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data,
ImageInfo->Thumbnail.size);
if (fgot < ImageInfo->Thumbnail.size) {
EXIF_ERRLOG_THUMBEOF(ImageInfo)
+ efree(ImageInfo->Thumbnail.data);
+
+ ImageInfo->Thumbnail.data = NULL;
+ } else {
+ exif_thumbnail_build(ImageInfo);
}
- exif_thumbnail_build(ImageInfo);
}
}
}