diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-06-29 16:02:43 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-06-29 16:02:43 +0200 |
commit | a1dbe49d02e916e310cae352836d5c1615b7e101 (patch) | |
tree | 63bd356cadda5b4691131fe820219731a6ef36f8 | |
parent | ac83d621363ca8899b90e65cb574946704bfcdec (diff) | |
download | ffmpeg-a1dbe49d02e916e310cae352836d5c1615b7e101.tar.gz |
Propagate error return values from the smacker decoder.
-rw-r--r-- | libavcodec/smacker.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 21d60f85e1..d0a10bfdc8 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -292,7 +292,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int static int decode_header_trees(SmackVContext *smk) { GetBitContext gb; - int mmap_size, mclr_size, full_size, type_size; + int mmap_size, mclr_size, full_size, type_size, ret; mmap_size = AV_RL32(smk->avctx->extradata); mclr_size = AV_RL32(smk->avctx->extradata + 4); @@ -307,8 +307,9 @@ static int decode_header_trees(SmackVContext *smk) { smk->mmap_tbl[0] = 0; smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; } else { - if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size)) - return AVERROR_INVALIDDATA; + ret = smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size); + if (ret < 0) + return ret; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); @@ -316,8 +317,9 @@ static int decode_header_trees(SmackVContext *smk) { smk->mclr_tbl[0] = 0; smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; } else { - if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size)) - return AVERROR_INVALIDDATA; + ret = smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size); + if (ret < 0) + return ret; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); @@ -325,8 +327,9 @@ static int decode_header_trees(SmackVContext *smk) { smk->full_tbl[0] = 0; smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; } else { - if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size)) - return AVERROR_INVALIDDATA; + ret = smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size); + if (ret < 0) + return ret; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); @@ -334,8 +337,9 @@ static int decode_header_trees(SmackVContext *smk) { smk->type_tbl[0] = 0; smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1; } else { - if (smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size)) - return AVERROR_INVALIDDATA; + ret = smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size); + if (ret < 0) + return ret; } return 0; @@ -528,6 +532,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, static av_cold int decode_init(AVCodecContext *avctx) { SmackVContext * const c = avctx->priv_data; + int ret; c->avctx = avctx; @@ -540,8 +545,9 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR(EINVAL); } - if (decode_header_trees(c)) - return AVERROR_INVALIDDATA; + ret = decode_header_trees(c); + if (ret < 0) + return ret; return 0; } |