From 5dd906beff551bd71b294ee2360ebb067fc10fa0 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 5 Apr 2021 17:47:34 -0500 Subject: [PATCH] OSS-Fuzz: Test non-default opts w/ decompress_yuv The non-default options were not being tested because of a pixel format comparison buglet. This commit also changes the code in both decompression fuzz targets such that non-default options are tested based on the pixel format index rather than the pixel format value, which is a bit more idiot-proof. --- fuzz/decompress.cc | 4 ++-- fuzz/decompress_yuv.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fuzz/decompress.cc b/fuzz/decompress.cc index bad32524..022336aa 100644 --- a/fuzz/decompress.cc +++ b/fuzz/decompress.cc @@ -71,10 +71,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) int w = width, h = height; /* Test non-default decompression options on the first iteration. */ - if (pf == TJPF_RGB) + if (pfi == 0) flags |= TJFLAG_BOTTOMUP | TJFLAG_FASTUPSAMPLE | TJFLAG_FASTDCT; /* Test IDCT scaling on the second iteration. */ - if (pf == TJPF_BGRX) { + else if (pfi == 1) { w = (width + 1) / 2; h = (height + 1) / 2; } diff --git a/fuzz/decompress_yuv.cc b/fuzz/decompress_yuv.cc index dc4620c5..a8a7302f 100644 --- a/fuzz/decompress_yuv.cc +++ b/fuzz/decompress_yuv.cc @@ -68,10 +68,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) int w = width, h = height; /* Test non-default decompression options on the first iteration. */ - if (pf == TJPF_RGB) + if (pfi == 0) flags |= TJFLAG_BOTTOMUP | TJFLAG_FASTUPSAMPLE | TJFLAG_FASTDCT; /* Test IDCT scaling on the second iteration. */ - if (pf == TJPF_XRGB) { + else if (pfi == 1) { w = (width + 3) / 4; h = (height + 3) / 4; }