From 4a5ee8c39947fe6ce48383aac0e7053aade71e67 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Thu, 3 Mar 2022 21:21:05 +0100 Subject: [PATCH] avcodec/tiff: do not abort on zero denominator Fixes decoding valid DNG file. --- 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;