skia2/gn
Leon Scroggins III 2c65d51612 Make SkPngCodec only read as much of the stream as necessary
Previously, SkPngCodec assumed that the stream only contained one
image, which ended at the end of the stream. It read the stream in
arbitrarily-sized chunks, and then passed that data to libpng for
processing.

If a stream contains more than one image, this may result in reading
beyond the end of the image, making future reads read the wrong data.

Now, SkPngCodec starts by reading 8 bytes at a time. After the
signature, 8 bytes is enough to know which chunk is next and how many
bytes are in the chunk.

When decoding the size, we stop when we reach IDAT, and when decoding
the image, we stop when we reach IEND.

This manual parsing is necessary to support APNG, which is planned in
the future. It also allows us to remove the SK_GOOGLE3_PNG_HACK, which
was a workaround for reading more than necessary at the beginning of
the image.

Add a test that simulates the issue, by decoding a special stream that
reports an error if the codec attempts to read beyond the end.

Temporarily disable the partial decoding tests for png. A larger change
will be necessary to get those working again, and no clients are
currently relying on incrementally decoding PNGs (i.e. decode part of
an image, then decode further with more data).

Bug: skia:5368
BUG:34073812

Change-Id: If832f7b20565411226fb5be3c305a4d16bf9269d
Reviewed-on: https://skia-review.googlesource.com/13900
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2017-04-20 13:40:17 +00:00
..
__init__.py Make gn directory importable in python 2017-03-20 17:40:30 +00:00
android_framework_defines.gni remove unneeded android flag for lockpixels 2017-04-18 19:01:26 +00:00
ar.py GN: quiet alink spam on Mac 2016-11-07 14:19:32 +00:00
bench.gni Avoid extra bitmap copies in SkColorSpaceXformCanvas 2017-04-03 15:35:55 +00:00
BUILD.gn stop disabling threadsafe statics 2017-04-07 14:54:29 +00:00
BUILDCONFIG.gn Added support for building for tvOS 2017-03-14 22:55:04 +00:00
core.gni Remove SkOpTAllocator 2017-04-19 20:36:15 +00:00
cp.py GN: get Angle compiling on Windows. 2016-10-17 16:16:16 +00:00
effects.gni Implement SkBlurDrawLooper with SkLayerDrawLooper 2017-03-28 19:29:00 +00:00
find_headers.py Check-in vulkan.h into third_party and use that instead of local sdk vulkan.h 2017-04-20 13:09:27 +00:00
find_ios_sysroot.py Add iOS simulator support in GN. 2017-03-13 17:21:43 +00:00
gm.gni Fix SkLocalMatrixShader::isAImage() to respect local matrix and image local matrix 2017-04-12 16:36:51 +00:00
gn_helpers.py Basic standalone GN configs. 2016-07-21 12:25:45 -07:00
gn_meta_sln.py Move, rename, and document Visual Studio GN helper script 2016-12-14 16:41:52 +00:00
gn_to_bp.py Revert "Check-in vulkan.h into third_party and use that instead of local sdk vulkan.h" 2017-04-19 14:44:47 +00:00
gn_to_cmake.py Add support for lib_dirs to gn_to_cmake.py. 2016-10-28 15:07:10 +00:00
gpu.gni Add backend safe classes for passing in external texture and render targets into gpu 2017-04-18 20:33:58 +00:00
gypi_to_gn.py Add executable bit and shebang to python files 2016-08-18 04:36:25 -07:00
is_clang.py GN: match shell behavior for cc and cxx in is_clang.py 2016-09-27 09:29:24 -07:00
opts.gni remove MIPS DSP optimizations 2016-12-21 03:55:00 +00:00
package_ios.py Automate more parts of gn/package_ios.py. 2017-01-31 17:41:16 +00:00
pdf.gni Start inverting GN reading .gypis to GYP reading .gnis. 2016-10-26 17:47:00 +00:00
push_to_android.py skia_android_serial = "auto" 2017-01-12 16:30:17 +00:00
samples.gni Add a simple tool for isolating a path from an SKP 2017-03-27 19:19:19 +00:00
shared_sources.gni remove MIPS DSP optimizations 2016-12-21 03:55:00 +00:00
sksl.gni skslc can now be compiled with no Skia dependencies, in preparation for its eventual 2017-03-31 18:49:51 +00:00
tests.gni Make SkPngCodec only read as much of the stream as necessary 2017-04-20 13:40:17 +00:00
utils.gni Revert "Revert "Create new inset algorithm for spot shadows"" 2017-03-24 16:07:27 +00:00
xps.gni SkXPS: new document API. 2017-02-06 19:00:28 +00:00