Browse Source

AP_ROMFS: fixed range check in tinflate

this could cause valid compressed data to fail decompression
zr-v5.1
Andrew Tridgell 4 years ago
parent
commit
1c74f14162
  1. 2
      libraries/AP_ROMFS/tinflate.cpp

2
libraries/AP_ROMFS/tinflate.cpp

@ -353,7 +353,7 @@ static int tinf_decode_trees(TINF_DATA *d, TINF_TREE *lt, TINF_TREE *dt) @@ -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;

Loading…
Cancel
Save