CVE-2022-2058
Description
Divide By Zero error in tiffcrop in libtiff 4.4.0 allows attackers to cause a denial-of-service via a crafted tiff file. For users that compile libtiff from sources, the fix is available with commit f3a5e010.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
18- osv-coords16 versionspkg:rpm/almalinux/libtiffpkg:rpm/almalinux/libtiff-develpkg:rpm/almalinux/libtiff-toolspkg:rpm/opensuse/tiff&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/tiff&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/tiff&distro=openSUSE%20Leap%20Micro%205.2pkg:rpm/opensuse/tiff&distro=openSUSE%20Tumbleweedpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Micro%205.2pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP3pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP4pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Desktop%20Applications%2015%20SP3pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Package%20Hub%2015%20SP3pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Package%20Hub%2015%20SP4pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP5pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP5pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Software%20Development%20Kit%2012%20SP5
< 4.0.9-26.el8_7+ 15 more
- (no CPE)range: < 4.0.9-26.el8_7
- (no CPE)range: < 4.0.9-26.el8_7
- (no CPE)range: < 4.0.9-26.el8_7
- (no CPE)range: < 4.0.9-150000.45.11.1
- (no CPE)range: < 4.0.9-150000.45.11.1
- (no CPE)range: < 4.0.9-150000.45.11.1
- (no CPE)range: < 4.4.0-2.1
- (no CPE)range: < 4.0.9-150000.45.11.1
- (no CPE)range: < 4.0.9-150000.45.11.1
- (no CPE)range: < 4.0.9-150000.45.11.1
- (no CPE)range: < 4.0.9-150000.45.11.1
- (no CPE)range: < 4.0.9-150000.45.11.1
- (no CPE)range: < 4.0.9-150000.45.11.1
- (no CPE)range: < 4.0.9-44.51.1
- (no CPE)range: < 4.0.9-44.51.1
- (no CPE)range: < 4.0.9-44.51.1
Patches
Vulnerability mechanics
Root cause
"Missing division-by-zero check in computeOutputPixelOffsets allows a crafted TIFF file to cause a floating-point exception."
Attack vector
An attacker supplies a crafted TIFF file that triggers a floating-point exception (FPE) in `computeOutputPixelOffsets` when `tiffcrop` is invoked with options such as `-R 90 -H 300 -O landscape -P 300.0x300.0 -i` [ref_id=1]. The crafted file contains numerous malformed TIFF directory tags, invalid data types for `StripOffsets` and `StripByteCounts`, and lacks a PhotometricInterpretation tag, ultimately causing a division-by-zero error at `tiffcrop.c:5941` [ref_id=1]. No authentication is required; the attacker only needs to deliver the malicious file to a user or service that runs `tiffcrop` on it.
Affected code
The vulnerability resides in `tools/tiffcrop.c` at line 5941, within the function `computeOutputPixelOffsets` [ref_id=1]. This function is called from `main()` at line 2459 when processing a crafted TIFF file with the `tiffcrop` utility [ref_id=1].
What the fix does
The fix is available with commit `f3a5e010` in the libtiff repository [ref_id=1]. While the exact diff is not shown in the issue, the commit addresses the division-by-zero condition in `computeOutputPixelOffsets` by adding a check to prevent a zero divisor before performing the division at line 5941 of `tiffcrop.c`. Users who compile from source should apply this commit; otherwise, they should update to a libtiff release that includes the fix.
Preconditions
- inputThe attacker must supply a crafted TIFF file that triggers a division-by-zero in computeOutputPixelOffsets.
- configThe victim must run tiffcrop with specific options (e.g., -R 90 -H 300 -O landscape -P 300.0x300.0 -i) on the malicious file.
Reproduction
1. Build libtiff 4.4.0 (commit 19db1d316bf959de10df7491b7b78a256811b6e4) with debug flags: `CFLAGS="-g -O0" CXXFLAGS="-g -O0" ./configure --prefix=$PWD/build_orig --disable-shared && make -j && make install`. 2. Run the crafted PoC file through tiffcrop: `./build_orig/bin/tiffcrop -R 90 -H 300 -O landscape -P 300.0x300.0 -i poc /tmp/foo`. 3. Observe the "Floating point exception (core dumped)" output, confirming the FPE at `tiffcrop.c:5941` in `computeOutputPixelOffsets` [ref_id=1].
Generated on May 24, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
8- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/4TSS7MJ7OO7JO5BNKCRYSFU7UAYOKLA2/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OXUMJXVEAYFWRO3U3YHKSULHIVDOLEQS/mitrevendor-advisory
- www.debian.org/security/2023/dsa-5333mitrevendor-advisory
- lists.debian.org/debian-lts-announce/2023/01/msg00018.htmlmitremailing-list
- gitlab.com/gitlab-org/cves/-/blob/master/2022/CVE-2022-2058.jsonmitre
- gitlab.com/libtiff/libtiff/-/issues/428mitre
- gitlab.com/libtiff/libtiff/-/merge_requests/346mitre
- security.netapp.com/advisory/ntap-20220826-0001/mitre
News mentions
0No linked articles in our index yet.