libtiff: Merge branch 'tiffcrop_fix_#169' into 'master'

From d700853112caf9115ffab913c70dc5c3cf433d6e Mon Sep 17 00:00:00 2001
From: Su Laus <[EMAIL REDACTED]>
Date: Sun, 27 Nov 2022 20:34:40 +0000
Subject: [PATCH] tiffcrop: Add check if (bps != 1) in writeSingleSection()
 for...

---
 tools/tiffcrop.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index 90f57583..554c7bcb 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -7545,6 +7545,11 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
 	break;
    case COMPRESSION_CCITTFAX3:
    case COMPRESSION_CCITTFAX4:
+        if (bps != 1) {
+          TIFFError("writeCroppedImage",
+                    "Group 3/4 compression is not usable with bps > 1");
+          return (-1);
+        }
 	if (compression == COMPRESSION_CCITTFAX3) {
           if (g3opts != (uint32_t) -1)
 	    TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts);