summaryrefslogtreecommitdiffstats
path: root/libavcodec/huffman.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2007-12-01 09:39:59 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2007-12-01 09:39:59 +0000
commit892a4c2da8518aa5c86b6cfdd90a7f399a41c814 (patch)
tree717c50f5ed10141bb918db4c777d080a639eac51 /libavcodec/huffman.c
parent5d702d6db24bca64bd94a7ed0ad6211967084107 (diff)
downloadffmpeg-streaming-892a4c2da8518aa5c86b6cfdd90a7f399a41c814.zip
ffmpeg-streaming-892a4c2da8518aa5c86b6cfdd90a7f399a41c814.tar.gz
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. Originally committed as revision 11119 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/huffman.c')
-rw-r--r--libavcodec/huffman.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavcodec/huffman.c b/libavcodec/huffman.c
index f75346f..43a7855 100644
--- a/libavcodec/huffman.c
+++ b/libavcodec/huffman.c
@@ -82,6 +82,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
}
qsort(nodes, nb_codes, sizeof(Node), cmp);
cur_node = nb_codes;
+ nodes[nb_codes*2-1].count = 0;
for(i = 0; i < nb_codes*2-1; i += 2){
nodes[cur_node].sym = HNODE;
nodes[cur_node].count = nodes[i].count + nodes[i+1].count;
OpenPOWER on IntegriCloud