mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Fix a crash due to max symbol in a tree >= alphabet size
(cherry picked from commit 15253f91567ce7a2a4a3de8d70e54ba4b0641af3) Change-Id: I4fbeaea4c712dae3bef078aef9d302b44bc39ffb
This commit is contained in:
parent
6f01b830e2
commit
4af1858a10
@ -248,6 +248,10 @@ static int ReadHuffmanCode(int alphabet_size, VP8LDecoder* const dec,
|
||||
int i;
|
||||
for (i = 0; i < num_symbols; ++i) {
|
||||
symbols[i] = VP8LReadBits(br, num_bits);
|
||||
if (symbols[i] >= alphabet_size) {
|
||||
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
||||
return 0;
|
||||
}
|
||||
codes[i] = i;
|
||||
code_lengths[i] = num_symbols - 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user