File tiff-CVE-2023-3316.patch of Package tiff.32256

Index: tiff-4.0.9/libtiff/tif_close.c
===================================================================
--- tiff-4.0.9.orig/libtiff/tif_close.c
+++ tiff-4.0.9/libtiff/tif_close.c
@@ -122,11 +122,13 @@ TIFFCleanup(TIFF* tif)
 void
 TIFFClose(TIFF* tif)
 {
-	TIFFCloseProc closeproc = tif->tif_closeproc;
-	thandle_t fd = tif->tif_clientdata;
-
-	TIFFCleanup(tif);
-	(void) (*closeproc)(fd);
+	if (tif != NULL)
+    {
+        TIFFCloseProc closeproc = tif->tif_closeproc;
+        thandle_t fd = tif->tif_clientdata;
+		TIFFCleanup(tif);
+        (void)(*closeproc)(fd);
+    }
 }
 
 /* vim: set ts=8 sts=8 sw=8 noet: */
Index: tiff-4.0.9/tools/tiffcrop.c
===================================================================
--- tiff-4.0.9.orig/tools/tiffcrop.c
+++ tiff-4.0.9/tools/tiffcrop.c
@@ -2553,7 +2553,10 @@ main(int argc, char* argv[])
       }
     }
 
-  TIFFClose(out);
+  if (out != NULL)
+  {
+	  TIFFClose(out);
+  }
 
   return (0);
   } /* end main */
openSUSE Build Service is sponsored by