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

Unified Diff: src/images/SkImageDecoder_libico.cpp

Issue 712123002: Add tests (and fix!) for known bad ICO files. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « resources/invalid_images/sigsegv_favicon_2.ico ('k') | tests/BadIcoTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libico.cpp
diff --git a/src/images/SkImageDecoder_libico.cpp b/src/images/SkImageDecoder_libico.cpp
index cd8a292edc149d70f8cf46f6657e5df5052c0691..5240d09b8672dbdd1980b27bf7d959b8dbcb425f 100644
--- a/src/images/SkImageDecoder_libico.cpp
+++ b/src/images/SkImageDecoder_libico.cpp
@@ -159,7 +159,7 @@ SkImageDecoder::Result SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* b
const size_t size = read4Bytes(buf, 14 + choice*16); //matters?
const size_t offset = read4Bytes(buf, 18 + choice*16);
// promote the sum to 64-bits to avoid overflow
- if (((uint64_t)offset + size) > length) {
+ if (offset > length || size > length || ((uint64_t)offset + size) > length) {
return kFailure;
}
« no previous file with comments | « resources/invalid_images/sigsegv_favicon_2.ico ('k') | tests/BadIcoTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698