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

Unified Diff: third_party/ktx/ktx.cpp

Issue 514603003: Fail gracefully for KTX files with width or height of zero. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove space Created 6 years, 4 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/ktx/ktx.cpp
diff --git a/third_party/ktx/ktx.cpp b/third_party/ktx/ktx.cpp
index d62833fac4f1863425ba92b20497cc4aee9af924..2391bafcf84e9ec161518475dca001c947fbdaad 100644
--- a/third_party/ktx/ktx.cpp
+++ b/third_party/ktx/ktx.cpp
@@ -256,6 +256,11 @@ bool SkKTXFile::readKTXFile(const uint8_t* data, size_t dataLen) {
if (fHeader.fNumberOfFaces > 1) {
return false;
}
+
+ // We don't support width and/or height <= 0
+ if (fHeader.fPixelWidth <= 0 || fHeader.fPixelHeight <= 0) {
+ return false;
+ }
}
// Make sure that we have enough bytes left for the key/value
« 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