summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-10-20 15:51:46 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2020-10-20 16:04:48 -0400
commitfb7e5a78327b26198fed6ae78fb3d815add72d27 (patch)
tree3ab5754d3682909fe313ee4309bdcfe117e1194d
parentaf04e0b0e14b6d5cb8169cb48e4662031ff07b99 (diff)
downloadlighttpd-git-fb7e5a78327b26198fed6ae78fb3d815add72d27.tar.gz
[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
-rw-r--r--src/ls-hpack/lshpack.c5
1 files changed, 4 insertions, 1 deletions
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;