mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
Merge "BuildHuffmanTable check sorted[] array bounds before writing" into main
This commit is contained in:
commit
89c5b91746
@ -122,6 +122,9 @@ static int BuildHuffmanTable(HuffmanCode* const root_table, int root_bits,
|
|||||||
const int symbol_code_length = code_lengths[symbol];
|
const int symbol_code_length = code_lengths[symbol];
|
||||||
if (code_lengths[symbol] > 0) {
|
if (code_lengths[symbol] > 0) {
|
||||||
if (sorted != NULL) {
|
if (sorted != NULL) {
|
||||||
|
if(offset[symbol_code_length] >= code_lengths_size) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
sorted[offset[symbol_code_length]++] = symbol;
|
sorted[offset[symbol_code_length]++] = symbol;
|
||||||
} else {
|
} else {
|
||||||
offset[symbol_code_length]++;
|
offset[symbol_code_length]++;
|
||||||
|
Loading…
Reference in New Issue
Block a user