From fb7e5a78327b26198fed6ae78fb3d815add72d27 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Tue, 20 Oct 2020 15:51:46 -0400 Subject: [core] silence coverity warnings in ls-hpack The code originates from https://github.com/litespeedtech/ls-hpack and is explicitly documented as not needing to be initialized. x-ref: https://github.com/litespeedtech/ls-hpack/commit/634c69215f8646653bb4cb5cf448fb943008529f https://github.com/litespeedtech/ls-hpack/commit/d92883ca10f458b76168eee980f2ccb776917ad3 --- src/ls-hpack/lshpack.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ls-hpack/lshpack.c b/src/ls-hpack/lshpack.c index 3a7e0692..6f73f409 100644 --- a/src/ls-hpack/lshpack.c +++ b/src/ls-hpack/lshpack.c @@ -699,7 +699,7 @@ lshpack_enc_huff_encode (const unsigned char *src, uintptr_t bits; /* OK not to initialize this variable */ unsigned bits_used = 0, adj; struct encode_el cur_enc_code; -#if __GNUC__ +#if __GNUC__ && !defined(__COVERITY__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #pragma GCC diagnostic ignored "-Wuninitialized" @@ -762,6 +762,9 @@ lshpack_enc_huff_encode (const unsigned char *src, } else if (p_dst + sizeof(bits) <= dst_end) { + #ifdef __COVERITY__ + assert(bits_used); + #endif bits <<= sizeof(bits) * 8 - bits_used; bits_used = cur_enc_code.bits - (sizeof(bits) * 8 - bits_used); bits |= cur_enc_code.code >> bits_used; -- cgit v1.2.1