File tiff-CVE-2023-3618.patch of Package tiff.32962

Index: tiff-4.0.9/tools/tiffcrop.c
===================================================================
--- tiff-4.0.9.orig/tools/tiffcrop.c
+++ tiff-4.0.9/tools/tiffcrop.c
@@ -2457,10 +2457,16 @@ main(int argc, char* argv[])
       if (page.mode == PAGE_MODE_NONE)
         {  /* Whole image or sections not based on output page size */
         if (crop.selections > 0)
-          {
-	  writeSelections(in, &out, &crop, &image, &dump, seg_buffs,
-                          mp, argv[argc - 1], &next_page, total_pages);
-          }
+		{
+			if (writeSelections(in, &out, &crop, &image, &dump,
+						seg_buffs, mp, argv[argc - 1],
+						&next_page, total_pages))
+			{
+				TIFFError("main",
+						"Unable to write new image selections");
+				exit(EXIT_FAILURE);
+			}
+		}
 	else  /* One file all images and sections */
           {
 	  if (update_output_file (&out, mp, crop.exp_mode, argv[argc - 1],
openSUSE Build Service is sponsored by