jchuff.c: Fix MSan error

Certain rare malformed input images can cause the Huffman encoder to
generate a value for nbits that corresponds to an uninitialized member
of the DC code table.  The ramifications of this are minimal and would
basically amount to a different bogus JPEG image being generated from a
particular bogus input image.
This commit is contained in:
DRC
2021-04-12 14:37:43 -05:00
parent 4e45161654
commit 3e68a5ee20
4 changed files with 2 additions and 17 deletions

View File

@@ -84,11 +84,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
iterations. */
if (ti == 0)
flags |= TJFLAG_BOTTOMUP | TJFLAG_ACCURATEDCT;
#if !defined(__has_feature) || !__has_feature(memory_sanitizer)
/* The libjpeg-turbo baseline Huffman encoder produces false positives with
MemorySanitizer. */
else if (ti == 1)
#endif
flags |= TJFLAG_PROGRESSIVE;
/* tjLoadImage() ignores 0-pixel images and images larger than 1 Megapixel