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.
This commit is contained in:
DRC
2021-04-05 17:47:34 -05:00
parent c81e91e8ca
commit 5dd906beff
2 changed files with 4 additions and 4 deletions

View File

@@ -71,10 +71,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
int w = width, h = height; int w = width, h = height;
/* Test non-default decompression options on the first iteration. */ /* Test non-default decompression options on the first iteration. */
if (pf == TJPF_RGB) if (pfi == 0)
flags |= TJFLAG_BOTTOMUP | TJFLAG_FASTUPSAMPLE | TJFLAG_FASTDCT; flags |= TJFLAG_BOTTOMUP | TJFLAG_FASTUPSAMPLE | TJFLAG_FASTDCT;
/* Test IDCT scaling on the second iteration. */ /* Test IDCT scaling on the second iteration. */
if (pf == TJPF_BGRX) { else if (pfi == 1) {
w = (width + 1) / 2; w = (width + 1) / 2;
h = (height + 1) / 2; h = (height + 1) / 2;
} }

View File

@@ -68,10 +68,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
int w = width, h = height; int w = width, h = height;
/* Test non-default decompression options on the first iteration. */ /* Test non-default decompression options on the first iteration. */
if (pf == TJPF_RGB) if (pfi == 0)
flags |= TJFLAG_BOTTOMUP | TJFLAG_FASTUPSAMPLE | TJFLAG_FASTDCT; flags |= TJFLAG_BOTTOMUP | TJFLAG_FASTUPSAMPLE | TJFLAG_FASTDCT;
/* Test IDCT scaling on the second iteration. */ /* Test IDCT scaling on the second iteration. */
if (pf == TJPF_XRGB) { else if (pfi == 1) {
w = (width + 3) / 4; w = (width + 3) / 4;
h = (height + 3) / 4; h = (height + 3) / 4;
} }