commit | b8e0960de41be52b3e6c85f08fdc722925c70941 | [log] [tgz] |
---|---|---|
author | scroggo <scroggo@chromium.org> | Tue Apr 12 07:41:22 2016 -0700 |
committer | Commit bot <commit-bot@chromium.org> | Tue Apr 12 07:41:22 2016 -0700 |
tree | 3107dcb1dbb04574321c079f54d5ee36a81ee479 | |
parent | 37798fbd82a7d064c5cc1516f120546a3408044b [diff] [blame] |
Make is_ktx safer Rather than assuming the data passed to ktx at least KTX_FILE_IDENTIFIER_SIZE, pass the length of the data to is_ktx and compare it. Splitting off from crrev.com/1862133002, which no longer depends on is_ktx. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1882593002 Review URL: https://codereview.chromium.org/1882593002
diff --git a/src/images/SkKTXImageEncoder.cpp b/src/images/SkKTXImageEncoder.cpp index 5dc347a..4b318a2 100644 --- a/src/images/SkKTXImageEncoder.cpp +++ b/src/images/SkKTXImageEncoder.cpp
@@ -56,7 +56,7 @@ } // Is it a KTX file?? - if (SkKTXFile::is_ktx(bytes)) { + if (SkKTXFile::is_ktx(bytes, data->size())) { return stream->write(bytes, data->size()); }