xform fuzz: Use only xform opts to set entropy alg

This is subtle, but the tj3DecompressHeader() function sets the values
of TJPARAM_ARITHMETIC, TJPARAM_OPTIMIZE, and TJPARAM_PROGRESSIVE.
Unless we unset those values, the entropy algorithm used in the
transformed JPEG image will be determined by the union of the parameter
values and the transform options, which isn't what we want.
This commit is contained in:
DRC
2023-07-01 08:09:23 -04:00
parent e0c53aa38f
commit 02b074fd90

View File

@@ -55,6 +55,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
width = tj3Get(handle, TJPARAM_JPEGWIDTH);
height = tj3Get(handle, TJPARAM_JPEGHEIGHT);
jpegSubsamp = tj3Get(handle, TJPARAM_SUBSAMP);
/* Let the transform options dictate the entropy coding algorithm. */
tj3Set(handle, TJPARAM_ARITHMETIC, 0);
tj3Set(handle, TJPARAM_PROGRESSIVE, 0);
tj3Set(handle, TJPARAM_OPTIMIZE, 0);
/* Ignore 0-pixel images and images larger than 1 Megapixel. Casting width
to (uint64_t) prevents integer overflow if width * height > INT_MAX. */