aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2013-06-12 14:27:00 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-06-16 15:58:26 +0200
commit5e6122ddadae542350933c2077434f17d51587a7 (patch)
tree107a86aecba441f8ea5fe76a519a48ef32bdd618
parent1a0cdd18b0cc3373c3a1348a8d5a4dab86a994d5 (diff)
downloadffmpeg-5e6122ddadae542350933c2077434f17d51587a7.tar.gz
smacker: check the return value of smacker_decode_tree
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org> (cherry picked from commit a2f9937bb04b23a341b0ec0eb1d923bbeb420277) Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--libavcodec/smacker.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 8c26e1ec4f..a72d7c5a35 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -639,7 +639,16 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
h[i].lengths = av_mallocz(256 * sizeof(int));
h[i].values = av_mallocz(256 * sizeof(int));
skip_bits1(&gb);
- smacker_decode_tree(&gb, &h[i], 0, 0);
+ if (smacker_decode_tree(&gb, &h[i], 0, 0) < 0) {
+ for (; i >= 0; i--) {
+ if (vlc[i].table)
+ ff_free_vlc(&vlc[i]);
+ av_free(h[i].bits);
+ av_free(h[i].lengths);
+ av_free(h[i].values);
+ }
+ return AVERROR_INVALIDDATA;
+ }
skip_bits1(&gb);
if(h[i].current > 1) {
res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length,