Skip to content

3.19.33

Latest

Choose a tag to compare

@danoli3 danoli3 released this 13 Nov 03:49

FreeImage 3.19.33

Security fixes for JPEG XR, HDR, IFF, PICT and WBMP loading, and a SharpYUV WebP save flag. Upgrading is recommended for any application that loads untrusted images.

Security fixes

Advisory Format Issue Reporter
GHSA-gwj3-px9g-x6gf JPEG XR Heap buffer overflow in metadata parsing (BUILD_JXR=ON) marcellomaugeri
GHSA-2jrc-675j-96jw JPEG XR Out-of-bounds stack read in container signature parsing marcellomaugeri
GHSA-994h-2f6q-8wh6 JPEG XR Out-of-bounds stack read in codestream signature parsing marcellomaugeri
GHSA-hv6w-96fr-cc96 HDR Negative height or width causes an out-of-bounds heap write michaelknap
GHSA-jxrm-w825-p3xp IFF Malformed FORM or chunk size causes an infinite loop michaelknap
GHSA-q9vw-fx7r-5qmp PICT Truncated input causes an infinite loop michaelknap
GHSA-65pp-rfw7-4xq6 WBMP Truncated extension header causes an infinite loop michaelknap
  • JPEG XR metadata: ReadBinaryData() sized its buffer as uCount + 2 in 32-bit arithmetic, so a count of 0xFFFFFFFE or 0xFFFFFFFF wrapped to a 0 or 1 byte allocation while the stream was still asked for the full count. The count is now widened to size_t first, and counts that would overflow are rejected.
  • JPEG XR signatures: the container (II) and codestream (WMPHOTO) signatures were read into unterminated stack buffers and checked with strstr(), which ran past the buffer on non-zero input. Both are now compared with memcmp().
  • HDR: header dimensions were parsed through signed %d into unsigned values. They are now rejected unless positive.
  • IFF: FORM and chunk sizes, odd-length padding and offsets are now validated before chunks are skipped.
  • PICT: Read8() returned a synthetic zero at end of file, which the header loop treated as padding forever. Failed reads now stop parsing.
  • WBMP: a failed read left the continuation bit set so the parser never advanced. Every header read must now return its byte.

Regression tests (JxrMetadataCountTest, JxrSignatureTest, and the HDR, IFF, PICT and WBMP tests) reproduce these bugs under AddressSanitizer without the fixes.

New

  • WEBP_SHARPYUV save flag for SharpYUV RGB to YUV conversion in lossy WebP. Combine it with a quality value.

Notes

  • No bundled library versions changed since 3.19.32. LibJXR carries local fixes in JXRMeta.c, JXRGlueJxr.c and strdec.c; keep them when re-syncing jxrlib.
  • The JPEG XR advisories only affect builds with BUILD_JXR=ON, which is on by default on Windows.

Contributors

Thanks to everyone who contributed to this release:

Full changelog: https://github.com/danoli3/FreeImage/blob/3.19.33/CHANGELOG.md
Compare: 3.19.32...3.19.33

What's Changed

  • Add WEBP_SHARPYUV save flag (SharpYUV for lossy WebP) by @danoli3 in #278
  • FreeImage 3.19.33 by @danoli3 in #279
  • Fix JPEG XR signature out-of-bounds stack reads by @danoli3 in #280

Full Changelog: 3.19.32...3.19.33