Patch libtiff for CVE-2023-52356 (#8298) (#9616)

Co-authored-by: xiaohong <Xiaohong-Deng@users.noreply.github.com>
This commit is contained in:
jslobodzian 2024-07-05 17:06:35 -04:00 коммит произвёл GitHub
Родитель 312b25721c
Коммит 637d3726bd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 50 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,45 @@
From 51558511bdbbcffdce534db21dbaf5d54b31638a Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Tue, 31 Oct 2023 15:58:41 +0100
Subject: [PATCH] TIFFReadRGBAStrip/TIFFReadRGBATile: add more validation of
col/row (fixes #622)
---
libtiff/tif_getimage.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
index 41f7dfd77..6fee35db2 100644
--- a/libtiff/tif_getimage.c
+++ b/libtiff/tif_getimage.c
@@ -3224,6 +3224,13 @@ int TIFFReadRGBAStripExt(TIFF *tif, uint32_t row, uint32_t *raster,
if (TIFFRGBAImageOK(tif, emsg) &&
TIFFRGBAImageBegin(&img, tif, stop_on_error, emsg))
{
+ if (row >= img.height)
+ {
+ TIFFErrorExtR(tif, TIFFFileName(tif),
+ "Invalid row passed to TIFFReadRGBAStrip().");
+ TIFFRGBAImageEnd(&img);
+ return (0);
+ }
img.row_offset = row;
img.col_offset = 0;
@@ -3301,6 +3308,14 @@ int TIFFReadRGBATileExt(TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster,
return (0);
}
+ if (col >= img.width || row >= img.height)
+ {
+ TIFFErrorExtR(tif, TIFFFileName(tif),
+ "Invalid row/col passed to TIFFReadRGBATile().");
+ TIFFRGBAImageEnd(&img);
+ return (0);
+ }
+
/*
* The TIFFRGBAImageGet() function doesn't allow us to get off the
* edge of the image, even to fill an otherwise valid tile. So we
--
GitLab

Просмотреть файл

@ -1,13 +1,14 @@
Summary: TIFF libraries and associated utilities.
Name: libtiff
Version: 4.6.0
Release: 1%{?dist}
Release: 2%{?dist}
License: libtiff
Vendor: Microsoft Corporation
Distribution: Azure Linux
Group: System Environment/Libraries
URL: https://gitlab.com/libtiff/libtiff
Source0: https://gitlab.com/libtiff/libtiff/-/archive/v%{version}/libtiff-v%{version}.tar.gz
Patch0: CVE-2023-52356.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libjpeg-turbo-devel
@ -60,6 +61,9 @@ make %{?_smp_mflags} -k check
%{_docdir}/*
%changelog
* Thu Mar 7 2024 Xiaohong Deng <xiaohongdeng@microsoft.com> - 4.6.0-2
- Add patches for CVE-2023-52356
* Fri Oct 20 2023 Neha Agarwal <nehaagarwal@microsoft.com> - 4.6.0-1
- Upgrade to v4.6.0 to fix CVE-2023-40745 and CVE-2023-41175