[FFmpeg-cvslog] avcodec/tiff: do not abort on zero denominator

Paul B Mahol git at videolan.org
Thu Mar 3 22:21:37 EET 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Mar  3 21:21:05 2022 +0100| [4a5ee8c39947fe6ce48383aac0e7053aade71e67] | committer: Paul B Mahol

avcodec/tiff: do not abort on zero denominator

Fixes decoding valid DNG file.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a5ee8c39947fe6ce48383aac0e7053aade71e67
---

 libavcodec/tiff.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 923f85d07f..e46a80e3ed 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1241,8 +1241,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
             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 denominator in rational\n");
-                return AVERROR_INVALIDDATA;
+                av_log(s->avctx, AV_LOG_WARNING, "Invalid denominator in rational\n");
+                value2 = 1;
             }
 
             break;
@@ -1421,8 +1421,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
                 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;
+                    av_log(s->avctx, AV_LOG_WARNING, "Invalid black level denominator\n");
+                    value2 = 1;
                 }
 
                 s->black_level = value / value2;



More information about the ffmpeg-cvslog mailing list