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

Unified Diff: src/core/SkBitmap.cpp

Issue 836733005: Verify size_t overflow (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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: src/core/SkBitmap.cpp
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 9db596de9cc9023fe32ae9b5ba24ae473e041345..97c1396bcd3eaefc6aaf1b593f94b609327c85d6 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1205,7 +1205,7 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) {
const int height = info.height();
const size_t snugSize = snugRB * height;
const size_t ramSize = ramRB * height;
- if (!buffer->validate(snugSize <= ramSize)) {
+ if (!buffer->validate((snugSize <= ramSize) && ((ramSize / ramRB) == height))) {
reed1 2015/01/06 22:29:34 perhaps we can explicitly use int64_t. We have han
return false;
}
« 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