aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2018-02-28 16:24:18 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-28 21:46:03 +0000
commit9e8a594905316d14aeb55ab5ab5f50e03cb847c6 (patch)
tree52fe46a142e298307fc1b75bc75d7821fdc3b2b3 /src/codec
parent84447e03ac2c8543d1e943cb6f754b910581e4bc (diff)
Support pngs with incorrect CMF bytes
Bug: chromium:807324 Though these pngs are technically incorrect, many such PNGs exist, and they are supported in Chromium. Ensure that users of SkCodec (e.g. Android, Flutter) display them as well. Change-Id: I2f1e573b4b7039cea81f96397cc0aa4cbc9461c3 Reviewed-on: https://skia-review.googlesource.com/111082 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/SkPngCodec.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 9df7bc67e1..df22121b4c 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -22,6 +22,7 @@
#include "SkTemplates.h"
#include "SkUtils.h"
+#define PNG_SET_OPTION_SUPPORTED
#include "png.h"
#include <algorithm>
@@ -787,6 +788,10 @@ static SkCodec::Result read_header(SkStream* stream, SkPngChunkReader* chunkRead
return SkCodec::kInternalError;
}
+ // This setting ensures that we display images with incorrect CMF bytes.
+ // See crbug.com/807324.
+ png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW, PNG_OPTION_ON);
+
AutoCleanPng autoClean(png_ptr, stream, chunkReader, outCodec);
png_infop info_ptr = png_create_info_struct(png_ptr);