Commit 16401656 authored by Yannis Guyon's avatar Yannis Guyon Committed by Commit Bot

third_party/libwebp/fuzzing: Restrict colorspace

In target libwebp_advanced_api_fuzzer, restrict
config.output.colorspace to MODE_RGBA, MODE_BGRA, MODE_rgbA and
MODE_bgrA, the only supported modes when WEBP_REDUCE_CSP is defined,
which is the case in chromium.

BUG=chromium:912628

Change-Id: I5f08fc85ece0a4a5a4d402d3fc7c77f794404b1c
Reviewed-on: https://chromium-review.googlesource.com/c/1368126Reviewed-by: default avatarJames Zern <jzern@google.com>
Commit-Queue: Yannis Guyon <yguyon@google.com>
Cr-Commit-Position: refs/heads/master@{#615631}
parent 03ff3df7
...@@ -54,7 +54,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) { ...@@ -54,7 +54,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
config.options.scaled_height = (int)(config.input.height * factor * 2); config.options.scaled_height = (int)(config.input.height * factor * 2);
} }
#if defined(WEBP_REDUCE_CSP)
config.output.colorspace = (value & 1)
? ((value & 2) ? MODE_RGBA : MODE_BGRA)
: ((value & 2) ? MODE_rgbA : MODE_bgrA);
#else
config.output.colorspace = (WEBP_CSP_MODE)(value % MODE_LAST); config.output.colorspace = (WEBP_CSP_MODE)(value % MODE_LAST);
#endif // WEBP_REDUCE_CSP
if (size % 3) { if (size % 3) {
// Decodes incrementally in chunks of increasing size. // Decodes incrementally in chunks of increasing size.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment