Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CVE-2022-0562 in libtiff #47

Merged
merged 1 commit into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build_scripts/build_libtiff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ patch -p1 < ${ROOT_DIR}/patches/libtiff-CVE-2022-0891.patch
patch -p1 < ${ROOT_DIR}/patches/libtiff-CVE-2022-0908.patch
patch -p1 < ${ROOT_DIR}/patches/libtiff-CVE-2022-0909.patch
patch -p1 < ${ROOT_DIR}/patches/libtiff-CVE-2022-0907.patch
patch -p1 < ${ROOT_DIR}/patches/libtiff-CVE-2022-0562.patch
./autogen.sh
./configure \
CFLAGS="-fPIC" \
Expand Down
27 changes: 27 additions & 0 deletions patches/libtiff-CVE-2022-0562.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 561599c99f987dc32ae110370cfdd7df7975586b Mon Sep 17 00:00:00 2001
From: Even Rouault <[email protected]>
Date: Sat, 5 Feb 2022 20:36:41 +0100
Subject: [PATCH] TIFFReadDirectory(): avoid calling memcpy() with a null
source pointer and size of zero (fixes #362)

---
libtiff/tif_dirread.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
index 2bbc4585..23194ced 100644
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -4177,7 +4177,8 @@ TIFFReadDirectory(TIFF* tif)
goto bad;
}

- memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16_t));
+ if (old_extrasamples > 0)
+ memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16_t));
_TIFFsetShortArray(&tif->tif_dir.td_sampleinfo, new_sampleinfo, tif->tif_dir.td_extrasamples);
_TIFFfree(new_sampleinfo);
}
--
2.25.1