adenilson / rpms / zlib

Forked from rpms/zlib 8 months ago
Clone
ad1f37
From 1e56dd1e7285d3026092ba794078edb290b4c1b1 Mon Sep 17 00:00:00 2001
ad1f37
From: Ondrej Dubaj <odubaj@redhat.com>
ad1f37
Date: Mon, 15 Mar 2021 13:06:35 +0100
ad1f37
Subject: [PATCH] fixed isues found by covscan
ad1f37
ad1f37
---
ad1f37
 contrib/minizip/mztools.c | 8 ++++++++
ad1f37
 contrib/minizip/zip.c     | 4 ++--
ad1f37
 deflate.c                 | 5 +++--
ad1f37
 3 files changed, 13 insertions(+), 4 deletions(-)
ad1f37
ad1f37
diff --git a/contrib/minizip/mztools.c b/contrib/minizip/mztools.c
ad1f37
index 96891c2..1197928 100644
ad1f37
--- a/contrib/minizip/mztools.c
ad1f37
+++ b/contrib/minizip/mztools.c
ad1f37
@@ -286,6 +286,14 @@ uLong* bytesRecovered;
ad1f37
     }
ad1f37
   } else {
ad1f37
     err = Z_STREAM_ERROR;
ad1f37
+    if(fpZip != NULL)
ad1f37
+      fclose(fpZip);
ad1f37
+
ad1f37
+    if(fpOut != NULL)
ad1f37
+      fclose(fpOut);
ad1f37
+
ad1f37
+    if(fpOutCD != NULL)
ad1f37
+      fclose(fpOutCD);
ad1f37
   }
ad1f37
   return err;
ad1f37
 }
ad1f37
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
ad1f37
index 44e88a9..a753c17 100644
ad1f37
--- a/contrib/minizip/zip.c
ad1f37
+++ b/contrib/minizip/zip.c
ad1f37
@@ -526,8 +526,8 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
ad1f37
         break;
ad1f37
       }
ad1f37
 
ad1f37
-      if (uPosFound!=0)
ad1f37
-        break;
ad1f37
+    if (uPosFound!=0)
ad1f37
+      break;
ad1f37
   }
ad1f37
   TRYFREE(buf);
ad1f37
   return uPosFound;
ad1f37
diff --git a/deflate.c b/deflate.c
ad1f37
index 085abbe..3963e79 100644
ad1f37
--- a/deflate.c
ad1f37
+++ b/deflate.c
ad1f37
@@ -203,9 +203,10 @@ local const config configuration_table[10] = {
ad1f37
  * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
ad1f37
  * prev[] will be initialized on the fly.
ad1f37
  */
ad1f37
-#define CLEAR_HASH(s) \
ad1f37
+#define CLEAR_HASH(s) do { \
ad1f37
     s->head[s->hash_size-1] = NIL; \
ad1f37
-    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
ad1f37
+    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
ad1f37
+} while (0)
ad1f37
 
ad1f37
 /* ===========================================================================
ad1f37
  * Slide the hash table when sliding the window down (could be avoided with 32
ad1f37
-- 
ad1f37
2.26.0
ad1f37