libtiff: PackBitsDecode: zero-initialize (not-yet-written parts of) output buffer if failure

From 2fc4422e3ce80887578dc0d9c1e1a0ecd07b9da5 Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Sun, 26 May 2024 19:57:08 +0200
Subject: [PATCH] PackBitsDecode: zero-initialize (not-yet-written parts of)
 output buffer if failure

---
 libtiff/tif_packbits.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libtiff/tif_packbits.c b/libtiff/tif_packbits.c
index 62849f8f..1ae50cbd 100644
--- a/libtiff/tif_packbits.c
+++ b/libtiff/tif_packbits.c
@@ -300,6 +300,7 @@ static int PackBitsDecode(TIFF *tif, uint8_t *op, tmsize_t occ, uint16_t s)
     tif->tif_rawcc = cc;
     if (occ > 0)
     {
+        memset(op, 0, (size_t)occ);
         TIFFErrorExtR(tif, module, "Not enough data for scanline %" PRIu32,
                       tif->tif_row);
         return (0);