File tiff-CVE-2022-0908.patch of Package tiff.27567

Index: tiff-4.0.9/libtiff/tif_dirread.c
===================================================================
--- tiff-4.0.9.orig/libtiff/tif_dirread.c
+++ tiff-4.0.9/libtiff/tif_dirread.c
@@ -4973,7 +4973,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEnt
 								_TIFFfree(data);
 							return(0);
 						}
-						_TIFFmemcpy(o,data,(uint32)dp->tdir_count);
+						if (dp->tdir_count > 0 )
+						{
+							_TIFFmemcpy(o,data,(uint32)dp->tdir_count);
+						}
 						o[(uint32)dp->tdir_count]=0;
 						if (data!=0)
 							_TIFFfree(data);
openSUSE Build Service is sponsored by