Blame SOURCES/0005-CVE-2022-2519-CVE-2022-2520-CVE-2022-2521-tiffcrop-S.patch

1e79a1
From 670117c3a76bc0f995bfdb6c293ab2ce9af18273 Mon Sep 17 00:00:00 2001
1e79a1
From: Su_Laus <sulau@freenet.de>
1e79a1
Date: Sat, 20 Aug 2022 23:35:26 +0200
1e79a1
Subject: [PATCH] (CVE-2022-2519 CVE-2022-2520 CVE-2022-2521) tiffcrop -S
1e79a1
 option: Make decision simpler.
1e79a1
1e79a1
(cherry picked from commit bad48e90b410df32172006c7876da449ba62cdba)
1e79a1
---
1e79a1
 tools/tiffcrop.c | 10 +++++-----
1e79a1
 1 file changed, 5 insertions(+), 5 deletions(-)
1e79a1
1e79a1
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
1e79a1
index d9213ecb..0551a01c 100644
1e79a1
--- a/tools/tiffcrop.c
1e79a1
+++ b/tools/tiffcrop.c
1e79a1
@@ -2133,11 +2133,11 @@ void  process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
1e79a1
     }
1e79a1
     /*-- Check for not allowed combinations (e.g. -X, -Y and -Z, -z and -S are mutually exclusive) --*/
1e79a1
     char XY, Z, R, S;
1e79a1
-    XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH));
1e79a1
-    Z = (crop_data->crop_mode & CROP_ZONES);
1e79a1
-    R = (crop_data->crop_mode & CROP_REGIONS);
1e79a1
-    S = (page->mode & PAGE_MODE_ROWSCOLS);
1e79a1
-    if ((XY && Z) || (XY && R) || (XY && S) || (Z && R) || (Z && S) || (R && S)) {
1e79a1
+    XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH)) ? 1 : 0;
1e79a1
+    Z = (crop_data->crop_mode & CROP_ZONES) ? 1 : 0;
1e79a1
+    R = (crop_data->crop_mode & CROP_REGIONS) ? 1 : 0;
1e79a1
+    S = (page->mode & PAGE_MODE_ROWSCOLS) ? 1 : 0;
1e79a1
+    if (XY + Z + R + S > 1) {
1e79a1
         TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->Exit");
1e79a1
         exit(EXIT_FAILURE);
1e79a1
     }