Skip to content

Commit 6be2f0c

Browse files
[AutoPR- Security] Patch libtiff for CVE-2025-9165, CVE-2025-8851 [MEDIUM] (#14556)
1 parent e3237a2 commit 6be2f0c

File tree

3 files changed

+107
-1
lines changed

3 files changed

+107
-1
lines changed

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 e7b8272356a0cdcb91a0974019d043db946ca546 Mon Sep 17 00:00:00 2001
2+
From: Lee Howard <[email protected]>
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 <[email protected]>
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 7fc2038790da6720c653e3c46e2f468e93ced796 Mon Sep 17 00:00:00 2001
2+
From: Su_Laus <[email protected]>
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 <[email protected]>
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: Azure Linux
@@ -16,6 +16,8 @@ Patch4: CVE-2023-6228.patch
1616
Patch5: CVE-2025-8534.patch
1717
Patch6: CVE-2025-8177.patch
1818
Patch7: CVE-2025-8176.patch
19+
Patch8: CVE-2025-8851.patch
20+
Patch9: CVE-2025-9165.patch
1921

2022
BuildRequires: autoconf
2123
BuildRequires: automake
@@ -72,6 +74,9 @@ make %{?_smp_mflags} -k check
7274
%exclude %{_docdir}/tiff-%{version}/LICENSE.md
7375

7476
%changelog
77+
* Thu Aug 21 2025 Azure Linux Security Servicing Account <[email protected]> - 4.6.0-8
78+
- Patch for CVE-2025-9165, CVE-2025-8851
79+
7580
* Tue Aug 05 2025 Azure Linux Security Servicing Account <[email protected]> - 4.6.0-7
7681
- Patch for CVE-2025-8534, CVE-2025-8177, CVE-2025-8176
7782

0 commit comments

Comments
 (0)