File zlib-bnc1003577.patch of Package zlib.3732

From 3fb251b363866417122fe54a158a1ac5a7837101 Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Wed, 21 Sep 2016 20:07:37 -0700
Subject: [PATCH] Remove dummy structure declarations for old buggy compilers.

While woolly mammoths still roamed the Earth and before Atlantis
sunk into the ocean, there were C compilers that could not handle
forward structure references, e.g. "struct name;". zlib dutifully
provided a work-around for such compilers. That work-around is no
longer needed, and, per the recommendation of a security audit of
the zlib code by Trail of Bits and TrustInSoft, in support of the
Mozilla Foundation, should be removed since what a compiler will
do with this is technically undefined. From the report: "there is
no telling what interactions the bug could have in the future with
link-time optimizations and type-based alias analyses, both
features that are present (but not default) in clang."
---
 deflate.c       | 4 ----
 zconf.h         | 5 -----
 zconf.h.cmakein | 5 -----
 zconf.h.in      | 5 -----
 zlib.h          | 5 -----
 zutil.c         | 4 ----
 6 files changed, 28 deletions(-)

Index: zlib-1.2.8/deflate.c
===================================================================
--- zlib-1.2.8.orig/deflate.c
+++ zlib-1.2.8/deflate.c
@@ -151,10 +151,6 @@ local const config configuration_table[1
 #define EQUAL 0
 /* result of memcmp for equal strings */
 
-#ifndef NO_DUMMY_DECL
-struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
-#endif
-
 /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
 #define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0))
 
Index: zlib-1.2.8/zconf.h
===================================================================
--- zlib-1.2.8.orig/zconf.h
+++ zlib-1.2.8/zconf.h
@@ -224,11 +224,6 @@
 #  define z_const
 #endif
 
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-#  define NO_DUMMY_DECL
-#endif
-
 /* Maximum value for memLevel in deflateInit2 */
 #ifndef MAX_MEM_LEVEL
 #  ifdef MAXSEG_64K
Index: zlib-1.2.8/zconf.h.cmakein
===================================================================
--- zlib-1.2.8.orig/zconf.h.cmakein
+++ zlib-1.2.8/zconf.h.cmakein
@@ -226,11 +226,6 @@
 #  define z_const
 #endif
 
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-#  define NO_DUMMY_DECL
-#endif
-
 /* Maximum value for memLevel in deflateInit2 */
 #ifndef MAX_MEM_LEVEL
 #  ifdef MAXSEG_64K
Index: zlib-1.2.8/zconf.h.in
===================================================================
--- zlib-1.2.8.orig/zconf.h.in
+++ zlib-1.2.8/zconf.h.in
@@ -224,11 +224,6 @@
 #  define z_const
 #endif
 
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-#  define NO_DUMMY_DECL
-#endif
-
 /* Maximum value for memLevel in deflateInit2 */
 #ifndef MAX_MEM_LEVEL
 #  ifdef MAXSEG_64K
Index: zlib-1.2.8/zlib.h
===================================================================
--- zlib-1.2.8.orig/zlib.h
+++ zlib-1.2.8/zlib.h
@@ -1741,11 +1741,6 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile f
 
 #endif /* !Z_SOLO */
 
-/* hack for buggy compilers */
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
-    struct internal_state {int dummy;};
-#endif
-
 /* undocumented functions */
 ZEXTERN const char   * ZEXPORT zError           OF((int));
 ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));
Index: zlib-1.2.8/zutil.c
===================================================================
--- zlib-1.2.8.orig/zutil.c
+++ zlib-1.2.8/zutil.c
@@ -10,10 +10,6 @@
 #  include "gzguts.h"
 #endif
 
-#ifndef NO_DUMMY_DECL
-struct internal_state      {int dummy;}; /* for buggy compilers */
-#endif
-
 z_const char * const z_errmsg[10] = {
 "need dictionary",     /* Z_NEED_DICT       2  */
 "stream end",          /* Z_STREAM_END      1  */
openSUSE Build Service is sponsored by