Mercurial > libavcodec.hg
comparison huffman.c @ 5960:94fa03139210 libavcodec
Fix nodes[nb_codes*2-1].count being uninitialized and used to initialize
nodes[nb_codes*2-2].count (thus making that invalid as well) in
ff_huff_build_tree.
Might fix some (hard to reproduce) crashes in VP6 decoder.
author | reimar |
---|---|
date | Sat, 01 Dec 2007 09:39:59 +0000 |
parents | 6ac956b341f2 |
children | e39e03d99d24 |
comparison
equal
deleted
inserted
replaced
5959:7d242886f17b | 5960:94fa03139210 |
---|---|
80 av_log(avctx, AV_LOG_ERROR, "Too high symbol frequencies. Tree construction is not possible\n"); | 80 av_log(avctx, AV_LOG_ERROR, "Too high symbol frequencies. Tree construction is not possible\n"); |
81 return -1; | 81 return -1; |
82 } | 82 } |
83 qsort(nodes, nb_codes, sizeof(Node), cmp); | 83 qsort(nodes, nb_codes, sizeof(Node), cmp); |
84 cur_node = nb_codes; | 84 cur_node = nb_codes; |
85 nodes[nb_codes*2-1].count = 0; | |
85 for(i = 0; i < nb_codes*2-1; i += 2){ | 86 for(i = 0; i < nb_codes*2-1; i += 2){ |
86 nodes[cur_node].sym = HNODE; | 87 nodes[cur_node].sym = HNODE; |
87 nodes[cur_node].count = nodes[i].count + nodes[i+1].count; | 88 nodes[cur_node].count = nodes[i].count + nodes[i+1].count; |
88 nodes[cur_node].n0 = i; | 89 nodes[cur_node].n0 = i; |
89 for(j = cur_node; j > 0; j--){ | 90 for(j = cur_node; j > 0; j--){ |