Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

Issue 11361023: Merge 132961 (merge bug: http://crbug.com/158840) - Fix potential overflow in jpeg exif reader. Fou… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
===================================================================
--- Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (revision 133084)
+++ Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (working copy)
@@ -187,7 +187,10 @@
unsigned ifdOffset;
if (!checkExifHeader(marker, isBigEndian, ifdOffset))
continue;
- ifdOffset += 6; // Account for 'Exif\0<fill byte>' header.
+ const unsigned offsetToTiffData = 6; // Account for 'Exif\0<fill byte>' header.
+ if (marker->data_length < offsetToTiffData || ifdOffset >= marker->data_length - offsetToTiffData)
+ continue;
+ ifdOffset += offsetToTiffData;
// The jpeg exif container format contains a tiff block for metadata.
// A tiff image file directory (ifd) consists of a uint16_t describing
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698