avcodec/tiff: do not abort on zero denominator

Fixes decoding valid DNG file.
This commit is contained in:
Paul B Mahol 2022-03-03 21:21:05 +01:00
parent ee88804d07
commit 4a5ee8c399
1 changed files with 4 additions and 4 deletions

View File

@ -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;