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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp

Issue 2108033003: Cancel image loads if decoding failed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
index b3bd7d93278ee227f858d7c18dbbf28eacff334c..2db06cd59449567bdb89c4940156bea6fadf0768 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
@@ -80,12 +80,16 @@ inline bool matchesBMPSignature(const char* contents)
return !memcmp(contents, "BM", 2);
}
-std::unique_ptr<ImageDecoder> ImageDecoder::create(const char* contents, size_t length, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions)
+size_t ImageDecoder::longestSignatureLength()
{
const size_t longestSignatureLength = sizeof("RIFF????WEBPVP") - 1;
- ASSERT(longestSignatureLength == 14);
+ DCHECK_EQ(14u, longestSignatureLength);
+ return 14u;
+}
- if (length < longestSignatureLength)
+std::unique_ptr<ImageDecoder> ImageDecoder::create(const char* contents, size_t length, AlphaOption alphaOption, GammaAndColorProfileOption colorOptions)
+{
+ if (length < longestSignatureLength())
return nullptr;
size_t maxDecodedBytes = Platform::current() ? Platform::current()->maxDecodedImageBytes() : noDecodedImageByteLimit;

Powered by Google App Engine
This is Rietveld 408576698