[FFmpeg-devel] [PATCH] avcodec/mjpegdec: Adjustable discard threshold
Michael Niedermayer
michael at niedermayer.cc
Sun Jun 27 16:53:07 EEST 2021
Fixes regression
Fixes: last frame of Ticket9287
Analysed-by: Andriy Gelman
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/mjpegdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 02a987fd0c..fbc94c46d7 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -338,7 +338,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height);
if (av_image_check_size(width, height, 0, s->avctx) < 0)
return AVERROR_INVALIDDATA;
- if (s->buf_size && (width + 7) / 8 * ((height + 7) / 8) > s->buf_size * 4LL)
+ if (s->buf_size && (width + 7) / 8 * ((height + 7) / 8) * (100LL - s->avctx->discard_damaged_percentage) > s->buf_size * 4LL * 100)
return AVERROR_INVALIDDATA;
nb_components = get_bits(&s->gb, 8);
--
2.17.1
More information about the ffmpeg-devel
mailing list