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

Unified Diff: Source/core/platform/image-decoders/gif/GIFImageReader.cpp

Issue 15914009: More tolerant about malformed GIF files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: added test file Created 7 years, 7 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/WebKit/chromium/tests/data/radient-bad-terminator.gif ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/image-decoders/gif/GIFImageReader.cpp
diff --git a/Source/core/platform/image-decoders/gif/GIFImageReader.cpp b/Source/core/platform/image-decoders/gif/GIFImageReader.cpp
index 1a7268a19ba20c71a3e76a1bbd410d6ca1fe63cf..a33f3bdba423a873ef641adc754a98c82cc975ca 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageReader.cpp
+++ b/Source/core/platform/image-decoders/gif/GIFImageReader.cpp
@@ -484,13 +484,13 @@ bool GIFImageReader::parse(size_t dataPosition, size_t len, bool parseSizeOnly)
}
case GIFImageStart: {
- if (*currentComponent == ';') { // terminator.
- GETN(0, GIFDone);
+ if (*currentComponent == '!') { // extension.
+ GETN(2, GIFExtension);
break;
}
- if (*currentComponent == '!') { // extension.
- GETN(2, GIFExtension);
+ if (*currentComponent == ',') { // image separator.
+ GETN(9, GIFImageHeader);
break;
}
@@ -498,11 +498,10 @@ bool GIFImageReader::parse(size_t dataPosition, size_t len, bool parseSizeOnly)
// (extension), or ';' (trailer), there is extraneous data
// between blocks. The GIF87a spec tells us to keep reading
// until we find an image separator, but GIF89a says such
- // a file is corrupt. We follow GIF89a and bail out.
- if (*currentComponent != ',')
- return false;
-
- GETN(9, GIFImageHeader);
+ // a file is corrupt. We follow Mozilla's implementation and
+ // proceed as if the file were correctly terminated, so the
+ // GIF will display.
+ GETN(0, GIFDone);
break;
}
« no previous file with comments | « Source/WebKit/chromium/tests/data/radient-bad-terminator.gif ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698