summaryrefslogtreecommitdiffstats
path: root/thirdparty/libwebp/src/utils/huffman_utils.c
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-15 22:41:52 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-15 22:41:52 +0200
commit82fb849678cef40f7b24d11a136b8661dcd13f42 (patch)
tree74984f7a83b27d654b37c723c178adc3f505568c /thirdparty/libwebp/src/utils/huffman_utils.c
parent2749645d2a7173308228aa5fb0793a260fab733f (diff)
parent09bd34df934a815279ffe73045d10e7f4b2f9660 (diff)
downloadredot-engine-82fb849678cef40f7b24d11a136b8661dcd13f42.tar.gz
Merge pull request #91943 from akien-mga/libwebp-1.4.0
libwebp: Update to 1.4.0
Diffstat (limited to 'thirdparty/libwebp/src/utils/huffman_utils.c')
-rw-r--r--thirdparty/libwebp/src/utils/huffman_utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/thirdparty/libwebp/src/utils/huffman_utils.c b/thirdparty/libwebp/src/utils/huffman_utils.c
index cf73abd437..16f9faaa9a 100644
--- a/thirdparty/libwebp/src/utils/huffman_utils.c
+++ b/thirdparty/libwebp/src/utils/huffman_utils.c
@@ -122,6 +122,9 @@ static int BuildHuffmanTable(HuffmanCode* const root_table, int root_bits,
const int symbol_code_length = code_lengths[symbol];
if (code_lengths[symbol] > 0) {
if (sorted != NULL) {
+ if(offset[symbol_code_length] >= code_lengths_size) {
+ return 0;
+ }
sorted[offset[symbol_code_length]++] = symbol;
} else {
offset[symbol_code_length]++;
@@ -267,11 +270,11 @@ int VP8LHuffmanTablesAllocate(int size, HuffmanTables* huffman_tables) {
// Have 'segment' point to the first segment for now, 'root'.
HuffmanTablesSegment* const root = &huffman_tables->root;
huffman_tables->curr_segment = root;
+ root->next = NULL;
// Allocate root.
root->start = (HuffmanCode*)WebPSafeMalloc(size, sizeof(*root->start));
if (root->start == NULL) return 0;
root->curr_table = root->start;
- root->next = NULL;
root->size = size;
return 1;
}