aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-25 22:30:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-25 22:54:14 +0200
commit91ad27e8f5fb931eb2e6d810d4090e570ff5c3a7 (patch)
tree0b3317910b3fc57ca3af7417dd95b2b0708a8930
parent9e552b65127aa51bf60726a38fb086ddaca74fdf (diff)
parent06c52faef27e5bded4ceda7e6d1541f9fb20e84c (diff)
downloadffmpeg-91ad27e8f5fb931eb2e6d810d4090e570ff5c3a7.tar.gz
Merge commit '06c52faef27e5bded4ceda7e6d1541f9fb20e84c' into release/0.10
* commit '06c52faef27e5bded4ceda7e6d1541f9fb20e84c': indeo4: Check the quantization matrix index indeo4: Do not access missing reference MV Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/indeo4.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c
index 4162d977f9..0c1d50ff2e 100644
--- a/libavcodec/indeo4.c
+++ b/libavcodec/indeo4.c
@@ -361,6 +361,11 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
av_log(avctx, AV_LOG_ERROR, "Custom quant matrix encountered!\n");
return AVERROR_INVALIDDATA;
}
+ if (band->quant_mat >= FF_ARRAY_ELEMS(quant_index_to_tab)) {
+ av_log_ask_for_sample(avctx, "Quantization matrix %d",
+ band->quant_mat);
+ return AVERROR_INVALIDDATA;
+ }
}
/* decode block huffman codebook */
@@ -463,7 +468,7 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
}
mb->mv_x = mb->mv_y = 0; /* no motion vector coded */
- if (band->inherit_mv) {
+ if (band->inherit_mv && ref_mb) {
/* motion vector inheritance */
if (mv_scale) {
mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
@@ -475,7 +480,10 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
}
} else {
if (band->inherit_mv) {
- mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */
+ /* copy mb_type from corresponding reference mb */
+ if (!ref_mb)
+ return AVERROR_INVALIDDATA;
+ mb->type = ref_mb->type;
} else if (ctx->frame_type == FRAMETYPE_INTRA) {
mb->type = 0; /* mb_type is always INTRA for intra-frames */
} else {
@@ -498,14 +506,15 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
mb->mv_x = mb->mv_y = 0; /* there is no motion vector in intra-macroblocks */
} else {
if (band->inherit_mv) {
- /* motion vector inheritance */
- if (mv_scale) {
- mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
- mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
- } else {
- mb->mv_x = ref_mb->mv_x;
- mb->mv_y = ref_mb->mv_y;
- }
+ if (ref_mb)
+ /* motion vector inheritance */
+ if (mv_scale) {
+ mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
+ mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
+ } else {
+ mb->mv_x = ref_mb->mv_x;
+ mb->mv_y = ref_mb->mv_y;
+ }
} else {
/* decode motion vector deltas */
mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table,