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:
Urvang Joshi 2012-04-05 11:19:24 +00:00 committed by James Zern
parent 6f01b830e2
commit 4af1858a10

View File

@ -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;
}