From: bluhm Date: Thu, 24 Mar 2022 22:04:27 +0000 (+0000) Subject: Backport zlib fix for the multi line CLEAR_HASH macro. There is X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b1b1dcfb261bc0c44561f61a8d75d2dc6c7cfd34;p=openbsd 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@ --- 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