Skip to content

Commit fd6d1ee

Browse files
[AutoPR- Security] Patch libtiff for CVE-2025-9165, CVE-2025-8851 [MEDIUM] (#14555)
1 parent e0fca46 commit fd6d1ee

3 files changed

Lines changed: 107 additions & 1 deletion

File tree

SPECS/libtiff/CVE-2025-8851.patch

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From df579d63e4152d3ae76d1c7979774295a7b9f174 Mon Sep 17 00:00:00 2001
2+
From: Lee Howard <faxguy@howardsilvan.com>
3+
Date: Sun, 11 Aug 2024 16:01:07 +0000
4+
Subject: [PATCH] Attempt to address tiffcrop Coverity scan issues 1605444,
5+
1605445, and 1605449.
6+
7+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
8+
Upstream-reference: https://gitlab.com/libtiff/libtiff/-/commit/8a7a48d7a645992ca83062b3a1873c951661e2b3.patch
9+
---
10+
archive/tools/tiffcrop.c | 17 ++++++++++++-----
11+
1 file changed, 12 insertions(+), 5 deletions(-)
12+
13+
diff --git a/archive/tools/tiffcrop.c b/archive/tools/tiffcrop.c
14+
index d3365de..93f0779 100644
15+
--- a/archive/tools/tiffcrop.c
16+
+++ b/archive/tools/tiffcrop.c
17+
@@ -5573,7 +5573,14 @@ static int readSeparateStripsIntoBuffer(TIFF *in, uint8_t *obuf,
18+
buff = srcbuffs[s];
19+
strip = (s * strips_per_sample) + j;
20+
bytes_read = TIFFReadEncodedStrip(in, strip, buff, stripsize);
21+
- rows_this_strip = (uint32_t)(bytes_read / src_rowsize);
22+
+ if (bytes_read < 0)
23+
+ {
24+
+ rows_this_strip = 0;
25+
+ }
26+
+ else
27+
+ {
28+
+ rows_this_strip = (uint32_t)(bytes_read / src_rowsize);
29+
+ }
30+
if (bytes_read < 0 && !ignore)
31+
{
32+
TIFFError(TIFFFileName(in),
33+
@@ -6002,7 +6009,7 @@ static int computeInputPixelOffsets(struct crop_mask *crop,
34+
rmargin = _TIFFClampDoubleToUInt32(crop->margins[3] * scale * xres);
35+
}
36+
37+
- if ((lmargin + rmargin) > image->width)
38+
+ if (lmargin == 0xFFFFFFFFU || rmargin == 0xFFFFFFFFU || (lmargin + rmargin) > image->width)
39+
{
40+
TIFFError("computeInputPixelOffsets",
41+
"Combined left and right margins exceed image width");
42+
@@ -6010,7 +6017,7 @@ static int computeInputPixelOffsets(struct crop_mask *crop,
43+
rmargin = (uint32_t)0;
44+
return (-1);
45+
}
46+
- if ((tmargin + bmargin) > image->length)
47+
+ if (tmargin == 0xFFFFFFFFU || bmargin == 0xFFFFFFFFU || (tmargin + bmargin) > image->length)
48+
{
49+
TIFFError("computeInputPixelOffsets",
50+
"Combined top and bottom margins exceed image length");
51+
@@ -6592,14 +6599,14 @@ static int computeOutputPixelOffsets(struct crop_mask *crop,
52+
((image->bps + 7) / 8));
53+
}
54+
55+
- if ((hmargin * 2.0) > (pwidth * page->hres))
56+
+ if (hmargin == 0xFFFFFFFFU || (hmargin * 2.0) > (pwidth * page->hres))
57+
{
58+
TIFFError("computeOutputPixelOffsets",
59+
"Combined left and right margins exceed page width");
60+
hmargin = (uint32_t)0;
61+
return (-1);
62+
}
63+
- if ((vmargin * 2.0) > (plength * page->vres))
64+
+ if (vmargin == 0xFFFFFFFFU || (vmargin * 2.0) > (plength * page->vres))
65+
{
66+
TIFFError("computeOutputPixelOffsets",
67+
"Combined top and bottom margins exceed page length");
68+
--
69+
2.45.4
70+

SPECS/libtiff/CVE-2025-9165.patch

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 735cd19c9df0aca080c864aa8be354b11241c987 Mon Sep 17 00:00:00 2001
2+
From: Su_Laus <sulau@freenet.de>
3+
Date: Fri, 8 Aug 2025 21:35:30 +0200
4+
Subject: [PATCH] tiffcmp: fix memory leak when second file cannot be opened.
5+
6+
Closes #728, #729
7+
8+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
9+
Upstream-reference: https://gitlab.com/libtiff/libtiff/-/commit/ed141286a37f6e5ddafb5069347ff5d587e7a4e0.patch
10+
---
11+
archive/tools/tiffcmp.c | 3 +++
12+
1 file changed, 3 insertions(+)
13+
14+
diff --git a/archive/tools/tiffcmp.c b/archive/tools/tiffcmp.c
15+
index 529c1cd..88d9470 100644
16+
--- a/archive/tools/tiffcmp.c
17+
+++ b/archive/tools/tiffcmp.c
18+
@@ -105,7 +105,10 @@ int main(int argc, char *argv[])
19+
return (2);
20+
tif2 = TIFFOpen(argv[optind + 1], "r");
21+
if (tif2 == NULL)
22+
+ {
23+
+ TIFFClose(tif1);
24+
return (2);
25+
+ }
26+
dirnum = 0;
27+
while (tiffcmp(tif1, tif2))
28+
{
29+
--
30+
2.45.4
31+

SPECS/libtiff/libtiff.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: TIFF libraries and associated utilities.
22
Name: libtiff
33
Version: 4.6.0
4-
Release: 7%{?dist}
4+
Release: 8%{?dist}
55
License: libtiff
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -16,6 +16,8 @@ Patch4: CVE-2023-6228.patch
1616
Patch5: CVE-2025-8176.patch
1717
Patch6: CVE-2025-8177.patch
1818
Patch7: CVE-2025-8534.patch
19+
Patch8: CVE-2025-8851.patch
20+
Patch9: CVE-2025-9165.patch
1921
BuildRequires: autoconf
2022
BuildRequires: automake
2123
BuildRequires: libjpeg-turbo-devel
@@ -68,6 +70,9 @@ make %{?_smp_mflags} -k check
6870
%{_docdir}/*
6971

7072
%changelog
73+
* Thu Aug 21 2025 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 4.6.0-8
74+
- Patch for CVE-2025-9165, CVE-2025-8851
75+
7176
* Wed Aug 06 2025 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 4.6.0-7
7277
- Patch for CVE-2025-8534, CVE-2025-8177, CVE-2025-8176
7378

0 commit comments

Comments
 (0)