Avoid integer overflow in SkIcoCodec and SkImageInfo
authorMatt Sarett <msarett@google.com>
Mon, 17 Oct 2016 18:32:46 +0000 (14:32 -0400)
committerMike Klein <mtklein@chromium.org>
Mon, 17 Oct 2016 21:19:54 +0000 (21:19 +0000)
commit29121ebd9e4673d7ca6ac1ba3dd905fbdc9d50aa
treecf85bf7e983c484137f566edd6970cbbae0b88a0
parentc03e1c55a79f00d02ab528945425ff50cb700402
Avoid integer overflow in SkIcoCodec and SkImageInfo

Original Commit Message:
"""
Avoid integer overflow in SkIcoCodec

Definitely good to avoid overflow here.

FWIW, this looks to be harmless for Android's current use.
They will just fail later on when trying to allocate the
bitmap.

BUG=skia:5857
"""

With the new test, ASAN also caught an integer overflow
bug in SkImageInfo.  Fix this as well.

CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN;master.client.skia.android:Test-Android-Clang-AndroidOne-CPU-MT6582-arm-Debug-GN_Android

BUG=skia:5857

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3568

Change-Id: I0d777a547850474ea6cea87e36efa05434e33635
Reviewed-on: https://skia-review.googlesource.com/3568
Reviewed-by: Kevin Lubick <kjlubick@google.com>
include/core/SkImageInfo.h
resources/invalid_images/int_overflow.ico [new file with mode: 0644]
src/codec/SkIcoCodec.cpp
tests/CodecTest.cpp