aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-04 13:37:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-10 02:13:10 +0200
commitd2142c3b3a98ecf5abf80afac0abf2798d4806ed (patch)
tree0eb69544693c66ed164e385c27f13b530121fa5e
parentac7a211b3be16946acc1832d54b5e3a39dde80ce (diff)
downloadffmpeg-d2142c3b3a98ecf5abf80afac0abf2798d4806ed.tar.gz
avcodec/ffv1dec: Check chroma shift parameters
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit d43cd6b08ed555c303478e3133717fbb2236be6e) Conflicts: libavcodec/ffv1dec.c
-rw-r--r--libavcodec/ffv1dec.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d1e6e4e864..eb8606a44a 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -507,6 +507,12 @@ static int read_extra_header(FFV1Context *f)
f->num_h_slices = 1 + get_symbol(c, state, 0);
f->num_v_slices = 1 + get_symbol(c, state, 0);
+ if (f->chroma_h_shift > 4U || f->chroma_v_shift > 4U) {
+ av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
+ f->chroma_h_shift, f->chroma_v_shift);
+ return AVERROR_INVALIDDATA;
+ }
+
if (f->num_h_slices > (unsigned)f->width || !f->num_h_slices ||
f->num_v_slices > (unsigned)f->height || !f->num_v_slices
) {
@@ -598,6 +604,12 @@ static int read_header(FFV1Context *f)
}
}
+ if (chroma_h_shift > 4U || chroma_v_shift > 4U) {
+ av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
+ chroma_h_shift, chroma_v_shift);
+ return AVERROR_INVALIDDATA;
+ }
+
f->colorspace = colorspace;
f->avctx->bits_per_raw_sample = bits_per_raw_sample;
f->chroma_planes = chroma_planes;