diff options
author | djsollen <djsollen@google.com> | 2014-08-27 08:00:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-27 08:00:09 -0700 |
commit | 6b0d6b43cf662735dc804d8142383452c7f246f9 (patch) | |
tree | 4bb7064d542441917742795d955cc9a1eca1fc9f /third_party/ktx | |
parent | ce7b1d5fadda5e0fd5a40257d4c8e1b6a0279597 (diff) |
Fail gracefully for KTX files with width or height of zero.
R=robertphillips@google.com
Author: djsollen@google.com
Review URL: https://codereview.chromium.org/514603003
Diffstat (limited to 'third_party/ktx')
-rw-r--r-- | third_party/ktx/ktx.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/third_party/ktx/ktx.cpp b/third_party/ktx/ktx.cpp index d62833fac4..2391bafcf8 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 |