mirror of https://git.ffmpeg.org/ffmpeg.git
mjpegdec: extend check for incompatible values of s->rgb and s->ls
This can happen if s->ls changes from 0 to 1, but picture allocation is skipped due to s->interlaced. In that case ff_jpegls_decode_picture could be called even though the s->picture_ptr frame has the wrong pixel format and thus a wrong linesize, which results in a too small zero buffer being allocated. This fixes an out-of-bounds read in ls_decode_line. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
parent
3f8564fe3c
commit
7ea2db6eaf
|
@ -632,7 +632,8 @@ unk_pixfmt:
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
|
av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->rgb && !s->lossless && !s->ls) {
|
if ((s->rgb && !s->lossless && !s->ls) ||
|
||||||
|
(!s->rgb && s->ls && s->nb_components > 1)) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n");
|
||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue