avcodec/mjpegdec: Try to continue decoding on zero quant matrix value

A zero value in the quantization matrix is invalid but in practice will
just set the transform coefficient to zero after inverse quantization.
Try to continue decoding if the AV_EF_EXPLODE flag is not set.

Fixes ticket #9287.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
pull/359/head
Andriy Gelman 4 years ago
parent 8257d6dda6
commit 78f21f4ec1
  1. 4
      libavcodec/mjpegdec.c

@ -217,7 +217,9 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
s->quant_matrixes[index][i] = get_bits(&s->gb, pr ? 16 : 8); s->quant_matrixes[index][i] = get_bits(&s->gb, pr ? 16 : 8);
if (s->quant_matrixes[index][i] == 0) { if (s->quant_matrixes[index][i] == 0) {
av_log(s->avctx, AV_LOG_ERROR, "dqt: 0 quant value\n"); int log_level = s->avctx->err_recognition & AV_EF_EXPLODE ? AV_LOG_ERROR : AV_LOG_WARNING;
av_log(s->avctx, log_level, "dqt: 0 quant value\n");
if (s->avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
} }

Loading…
Cancel
Save