aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-10 22:02:46 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-10 23:12:42 +0100
commitecc31630f9a16ead4272a078c281afcb4db87f21 (patch)
treeeb23b9bc2a1e4f459a38ba66c4d8d5228fa77f39 /libavcodec/mjpegdec.c
parent50f4f272fe3f09d757f5255c722ac34a4740f969 (diff)
downloadffmpeg-ecc31630f9a16ead4272a078c281afcb4db87f21.tar.gz
mjpegb: Detect changing nb of planes in interlaced video.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 499ed4ca0e..19d44e4bd7 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -251,6 +251,12 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (nb_components <= 0 ||
nb_components > MAX_COMPONENTS)
return -1;
+ if (s->interlaced && (s->bottom_field == !s->interlace_polarity)) {
+ if (nb_components != s->nb_components) {
+ av_log(s->avctx, AV_LOG_ERROR, "nb_components changing in interlaced picture\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
if (s->ls && !(s->bits <= 8 || nb_components == 1)) {
av_log(s->avctx, AV_LOG_ERROR,
"only <= 8 bits/component or 16-bit gray accepted for JPEG-LS\n");