AP_ROMFS: fixed range check in tinflate

this could cause valid compressed data to fail decompression
This commit is contained in:
Andrew Tridgell 2021-02-23 13:54:49 +11:00
parent b4119aa07b
commit 1c74f14162

View File

@ -353,7 +353,7 @@ static int tinf_decode_trees(TINF_DATA *d, TINF_TREE *lt, TINF_TREE *dt)
/* special code length 16-18 are handled here */
length = tinf_read_bits(d, lbits, lbase);
if (num + length >= hlimit) return TINF_DATA_ERROR;
if (num + length > hlimit) return TINF_DATA_ERROR;
for (; length; --length)
{
lengths[num++] = fill_value;