Skip to content

Commit b7dc3d9

Browse files
smalyshevcmb69
authored andcommitted
Fix bug #77988 - heap-buffer-overflow on php_jpg_get16
(cherry picked from commit 73ff419)
1 parent 53c1b48 commit b7dc3d9

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ PHP NEWS
66
. Implemented FR #72189 (Add missing CURL_VERSION_* constants). (Javier
77
Spagnoletti)
88

9+
- EXIF:
10+
. Fixed bug #77988 (heap-buffer-overflow on php_jpg_get16).
11+
(CVE-2019-11040) (Stas)
12+
913
- FPM:
1014
. Fixed bug #77934 (php-fpm kill -USR2 not working). (Jakub Zelenka)
1115
. Fixed bug #77921 (static.php.net doesn't work anymore). (Peter Kokot)

ext/exif/exif.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3920,6 +3920,8 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
39203920
if (c == 0xFF)
39213921
return FALSE;
39223922
marker = c;
3923+
if (pos>=ImageInfo->Thumbnail.size)
3924+
return FALSE;
39233925
length = php_jpg_get16(data+pos);
39243926
if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) {
39253927
return FALSE;

ext/exif/tests/bug77988.jpg

1.17 KB
Loading

ext/exif/tests/bug77988.phpt

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

0 commit comments

Comments
 (0)