blob: 719dabaecc9ec5655917b0af5c3a3cc4680f70e0 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001CVE: CVE-2022-0908
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From ef5a0bf271823df168642444d051528a68205cb0 Mon Sep 17 00:00:00 2001
6From: Even Rouault <even.rouault@spatialys.com>
7Date: Thu, 17 Feb 2022 15:28:43 +0100
8Subject: [PATCH 4/6] TIFFFetchNormalTag(): avoid calling memcpy() with a null
9 source pointer and size of zero (fixes #383)
10
11---
12 libtiff/tif_dirread.c | 5 ++++-
13 1 file changed, 4 insertions(+), 1 deletion(-)
14
15diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
16index d84147a0..4e8ce729 100644
17--- a/libtiff/tif_dirread.c
18+++ b/libtiff/tif_dirread.c
19@@ -5079,7 +5079,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
20 _TIFFfree(data);
21 return(0);
22 }
23- _TIFFmemcpy(o,data,(uint32_t)dp->tdir_count);
24+ if (dp->tdir_count > 0 )
25+ {
26+ _TIFFmemcpy(o,data,(uint32_t)dp->tdir_count);
27+ }
28 o[(uint32_t)dp->tdir_count]=0;
29 if (data!=0)
30 _TIFFfree(data);
31--
322.25.1
33