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

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: comments 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
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..f38ea31acc59b5008c39d914c6ab02103015f53d 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageReader.cpp
+++ b/Source/core/platform/image-decoders/gif/GIFImageReader.cpp
@@ -494,15 +494,19 @@ bool GIFImageReader::parse(size_t dataPosition, size_t len, bool parseSizeOnly)
break;
}
+ if (*currentComponent == ',') { // image separator.
+ GETN(9, GIFImageHeader);
+ break;
+ }
+
// If we get anything other than ',' (image separator), '!'
// (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;
}

Powered by Google App Engine
This is Rietveld 408576698