diff options
author | Leon Scroggins III <scroggo@google.com> | 2017-07-14 11:48:52 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-14 16:25:54 +0000 |
commit | fc4ee229a653d0e9d71f828e513c9d458c1eab57 (patch) | |
tree | b84dfc5d2293d4dcb5434e2acd91b27af298f65c /tests | |
parent | 82ddc94aff0c8400a35f8006ee448574347c0c28 (diff) |
Fix double delete in SkBmpCodec
Previously, if ReadHeader returned false, it deleted the input stream.
But there are a couple of cases where ReadHeader creates an SkCodec and
then returns false. The SkCodec deletes the stream, and then so does
NewFromStream.
Make sure that we do not double delete by only deleting if no SkCodec
was created.
Add a test, so such a double delete will be caught by the bots.
Bug: b/37623797
Change-Id: I787422c9af58f0b92ad9e9ef9ad87c54a12f5e31
Reviewed-on: https://skia-review.googlesource.com/23620
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CodecTest.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp index 1d7d89aa34..ac4afd190e 100644 --- a/tests/CodecTest.cpp +++ b/tests/CodecTest.cpp @@ -664,6 +664,7 @@ DEF_TEST(Codec_Empty, r) { #if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32)) test_invalid(r, "empty_images/zero_height.tiff"); #endif + test_invalid(r, "invalid_images/b37623797.ico"); } #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED |