summaryrefslogtreecommitdiff
path: root/lib/libz
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2022-03-24 22:04:28 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2022-03-24 22:04:28 +0000
commit2e08821cfb35b448b5fa9d3a5941130519eb7e7c (patch)
tree4f68d14564788bcb120a8dba37352ee19491a48f /lib/libz
parent1414414d2d3046c512f05543bc28b183ee0eb8f1 (diff)
Backport zlib fix for the multi line CLEAR_HASH macro. There is
an else branch where only half of the macro is executed conditionally. Acording to upstream comment this has only little impact. https://github.com/madler/zlib/commit/38e8ce32afbaa82f67d992b9f3056f281fe69259 OK deraadt@ tb@
Diffstat (limited to 'lib/libz')
-rw-r--r--lib/libz/deflate.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libz/deflate.c b/lib/libz/deflate.c
index 55cc69ea276..e9b0ff3d56c 100644
--- a/lib/libz/deflate.c
+++ b/lib/libz/deflate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: deflate.c,v 1.12 2021/07/04 14:24:49 tb Exp $ */
+/* $OpenBSD: deflate.c,v 1.13 2022/03/24 22:04:27 bluhm Exp $ */
/* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -187,8 +187,11 @@ local const config configuration_table[10] = {
* prev[] will be initialized on the fly.
*/
#define CLEAR_HASH(s) \
- s->head[s->hash_size-1] = NIL; \
- zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+ do { \
+ s->head[s->hash_size-1] = NIL; \
+ zmemzero((Bytef *)s->head, \
+ (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
+ } while (0)
/* ===========================================================================
* Slide the hash table when sliding the window down (could be avoided with 32