[FFmpeg-devel] [PATCH] avcodec/tiff: check the black level denominator

James Almer jamrial at gmail.com
Sat Oct 26 18:07:34 EEST 2019


Fixes ticket #8327.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/tiff.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index f537e99b5a..c34e97cd6d 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1413,6 +1413,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
             if (type == TIFF_RATIONAL) {
                 value  = ff_tget(&s->gb, TIFF_LONG, s->le);
                 value2 = ff_tget(&s->gb, TIFF_LONG, s->le);
+                if (!value2) {
+                    av_log(s->avctx, AV_LOG_ERROR, "Invalid black level denominator\n");
+                    return AVERROR_INVALIDDATA;
+                }
 
                 s->black_level = value / value2;
             } else
-- 
2.23.0



More information about the ffmpeg-devel mailing list