Skip to content

Commit dea2989

Browse files
committed
Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
1 parent e944ae6 commit dea2989

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

ext/exif/exif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3498,7 +3498,7 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
34983498
size_t length=2, pos=0;
34993499
jpeg_sof_info sof_info;
35003500

3501-
if (!data) {
3501+
if (!data || ImageInfo->Thumbnail.size < 4) {
35023502
return FALSE; /* nothing to do here */
35033503
}
35043504
if (memcmp(data, "\xFF\xD8\xFF", 3)) {

ext/exif/tests/bug78222.jpg

91 Bytes
Loading

ext/exif/tests/bug78222.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
3+
--SKIPIF--
4+
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
5+
--FILE--
6+
<?php
7+
exif_read_data(__DIR__."/bug78222.jpg", 'THUMBNAIL', FALSE, TRUE);
8+
?>
9+
DONE
10+
--EXPECTF--
11+
DONE

0 commit comments

Comments
 (0)