Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame^] | 1 | CVE: CVE-2022-0908 |
| 2 | Upstream-Status: Backport |
| 3 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 4 | |
| 5 | From ef5a0bf271823df168642444d051528a68205cb0 Mon Sep 17 00:00:00 2001 |
| 6 | From: Even Rouault <even.rouault@spatialys.com> |
| 7 | Date: Thu, 17 Feb 2022 15:28:43 +0100 |
| 8 | Subject: [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 | |
| 15 | diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c |
| 16 | index 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 | -- |
| 32 | 2.25.1 |
| 33 | |