summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-03-03 21:21:05 +0100
committerPaul B Mahol <onemda@gmail.com>2022-03-03 21:22:48 +0100
commit4a5ee8c39947fe6ce48383aac0e7053aade71e67 (patch)
treef9852a2708db6eaf5b1c96aada94f5e1c5c8dec1
parentee88804d07c145bc7bca40c94bf6fd4cf71c06e4 (diff)
avcodec/tiff: do not abort on zero denominator
Fixes decoding valid DNG file.
-rw-r--r--libavcodec/tiff.c8
1 files 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;