# CVE-2016-5319: LibTIFF heap buffer overflow in tif_packbits.c

Source: https://junglewise.ai/threats/cve-2016-5319-libtiff-heap-buffer-overflow-in-tif-packbits-c  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2017-01-20. Updated: 2026-05-13  
License: CC BY 4.0 with a link back

CVE-2016-5319 · Severity: medium · CVSS 6.5 · Published 2017-01-20

LibTIFF is a widely used library for reading and writing Tag Image File Format (TIFF) files. A vulnerability in this library allows a remote attacker to crash applications that process image files by providing a specially crafted BMP file. This could lead to a denial-of-service condition, impacting the availability of services or software that rely on LibTIFF for image processing.

Technologies: [Libtiff](https://junglewise.ai/threats/technologies/libtiff). Vendors: [Libtiff](https://junglewise.ai/threats/vendors/libtiff).

## Quick answers

**Is CVE-2016-5319 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2016-5319 being exploited in the wild.

**How severe is CVE-2016-5319?** Medium severity, with a CVSS score of 6.5, published 20 January 2017.

**Which products and versions are affected?** LibTIFF libtiff 4.0.6 and earlier.

**Is there a fix for CVE-2016-5319?** A patch was published on 2017-01-09: Gentoo GLSA indicates fix available in version 4.0.7. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2016-5319 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2016-5319?** Check whether you run Libtiff. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A heap-based buffer overflow exists in the PackBitsEncode function within tif_packbits.c in LibTIFF 4.0.6 and earlier. The vulnerability is triggered when the library processes a maliciously crafted BMP file via the bmp2tiff tool or other interfaces calling TIFFWriteScanline. The root cause is a failure to properly check the length of the buffer (bp) passed to the encoder. An attacker can exploit this by enticing a user to open a crafted image, resulting in an out-of-bounds read/write that causes a segmentation fault and application crash. The issue was addressed in LibTIFF version 4.0.7.

## Affected products

- LibTIFF libtiff 4.0.6 and earlier

## Timeline

- 2016-04-27: disclosed: Vulnerability details shared on oss-security mailing list.
- 2017-01-09: patched: Gentoo GLSA indicates fix available in version 4.0.7.
- 2017-01-20: advisory: NVD publication date.

## References

- [http://www.openwall.com/lists/oss-security/2016/04/27/6](http://www.openwall.com/lists/oss-security/2016/04/27/6)
- [http://www.openwall.com/lists/oss-security/2016/06/07/1](http://www.openwall.com/lists/oss-security/2016/06/07/1)
- [http://www.securityfocus.com/bid/88604](http://www.securityfocus.com/bid/88604)
- [https://security.gentoo.org/glsa/201701-16](https://security.gentoo.org/glsa/201701-16)

## Related threats

- [libtiff heap buffer overflow in tiff2pdf](https://junglewise.ai/threats/cve-2026-18495-libtiff-heap-buffer-overflow-in-tiff2pdf)
- [libtiff integer overflow in thumbnail buffer allocation](https://junglewise.ai/threats/cve-2026-52491-libtiff-integer-overflow-in-thumbnail-buffer-allocation)
- [libtiff integer overflow in rgb2ycbcr cvtRaster](https://junglewise.ai/threats/cve-2026-52492-libtiff-integer-overflow-in-rgb2ycbcr-cvtraster)
- [libtiff integer overflow in tiffcrop -S option](https://junglewise.ai/threats/cve-2026-52490-libtiff-integer-overflow-in-tiffcrop-s-option)
- [libtiff heap overflow in PixarLogDecode with 8BITABGR format](https://junglewise.ai/threats/cve-2026-12912-libtiff-heap-overflow-in-pixarlogdecode-with-8bitabgr-format)
