MINOR: quic: Possible overflow in qpack_get_varint()

This should fix CID 375051 in GH 1536 where a signed integer expression (1 << bit)
which could overflow was compared to a uint64_t.
This commit is contained in:
Frédéric Lécaille 2022-02-02 14:56:23 +01:00 committed by Amaury Denoyelle
parent ce2ecc9643
commit 6842485a84

View File

@ -67,8 +67,8 @@ static uint64_t qpack_get_varint(const unsigned char **buf, uint64_t *len_in, in
uint8_t shift = 0; uint8_t shift = 0;
len--; len--;
ret = *raw++ & ((1 << b) - 1); ret = *raw++ & ((1ULL << b) - 1);
if (ret != (uint64_t)((1 << b) - 1)) if (ret != (uint64_t)((1ULL << b) - 1))
goto end; goto end;
while (len && (*raw & 128)) { while (len && (*raw & 128)) {