summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-10-26 12:01:16 -0300
committerJames Almer <jamrial@gmail.com>2019-10-29 10:23:39 -0300
commitdad75924290e15996e75c335c6c30b1d8e2e48ea (patch)
tree42ea9aee8f8e2fdea80b08bfdc9f7c599f52bf91 /libavcodec/tiff.c
parentba6b20df3f74a6092dc01023b07760da58188d82 (diff)
avcodec/tiff: check the black level denominator
Fixes ticket #8327. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index f537e99b5a..636614aa28 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1240,6 +1240,11 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
case 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 denominator in rational\n");
+ return AVERROR_INVALIDDATA;
+ }
+
break;
case TIFF_STRING:
if (count <= 4) {
@@ -1413,6 +1418,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