aboutsummaryrefslogtreecommitdiff
path: root/bfd/compress.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/compress.c')
-rw-r--r--bfd/compress.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/bfd/compress.c b/bfd/compress.c
index d0f745f..07289e5 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -37,9 +37,12 @@ decompress_contents (bfd_byte *compressed_buffer,
/* It is possible the section consists of several compressed
buffers concatenated together, so we uncompress in a loop. */
- strm.zalloc = NULL;
- strm.zfree = NULL;
- strm.opaque = NULL;
+ /* PR 18313: The state field in the z_stream structure is supposed
+ to be invisible to the user (ie us), but some compilers will
+ still complain about it being used without initialisation. So
+ we first zero the entire z_stream structure and then set the fields
+ that we need. */
+ memset (& strm, 0, sizeof strm);
strm.avail_in = compressed_size - 12;
strm.next_in = (Bytef*) compressed_buffer + 12;
strm.avail_out = uncompressed_size;