|
@@ -335,7 +335,10 @@ static int huf_unpack_enc_table(GetByteContext *gb,
|
|
|
return ret;
|
|
|
|
|
|
for (; im <= iM; im++) {
|
|
|
- uint64_t l = freq[im] = get_bits(&gbit, 6);
|
|
|
+ uint64_t l;
|
|
|
+ if (get_bits_left(&gbit) < 6)
|
|
|
+ return AVERROR_INVALIDDATA;
|
|
|
+ l = freq[im] = get_bits(&gbit, 6);
|
|
|
|
|
|
if (l == LONG_ZEROCODE_RUN) {
|
|
|
int zerun = get_bits(&gbit, 8) + SHORTEST_LONG_RUN;
|