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

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

Issue 2907143002: Remove unnecessary decoded frame size overflow check (Closed)
Patch Set: Added DCHECK and logs to check the overflow Created 3 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0b76d3326f24edabb38900dfff72e8440d417c42..e9f93aec0ae6f79b9f83bb2d1c95750586dce832 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp
@@ -381,12 +381,12 @@ void ImageDecoder::UpdateAggressivePurging(size_t index) {
// As we decode we will learn the total number of frames, and thus total
// possible image memory used.
- const uint64_t frame_area = DecodedSize().Area();
- const uint64_t frame_memory_usage = frame_area * 4; // 4 bytes per pixel
- if (frame_memory_usage / 4 != frame_area) { // overflow occurred
- purge_aggressively_ = true;
- return;
- }
+ const uint64_t frame_memory_usage =
+ DecodedSize().Area() * 4; // 4 bytes per pixel
+
+ // This condition never fails in the current code. Our existing image decoders
+ // parse for the image size and SetFailed() if that size overflows
+ DCHECK_EQ(frame_memory_usage / 4, DecodedSize().Area());
const uint64_t total_memory_usage = frame_memory_usage * index;
if (total_memory_usage / frame_memory_usage != index) { // overflow occurred
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698