aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-03-16 02:00:17 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-23 13:15:17 +0200
commit232ced7f4e5fb5b77d87970d8fb146085a48c61e (patch)
tree97d11c765e4273c1975704c0f92ba3984799869b
parent64b7716802e413fe0c3389c364f689f8b0ed80c9 (diff)
downloadffmpeg-232ced7f4e5fb5b77d87970d8fb146085a48c61e.tar.gz
avcodec/tiff: Check stripsize strippos for overflow
Fixes: 861/clusterfuzz-testcase-5688284384591872 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 5d996b56499f00f80b02a41bab3d6b7349e36e9d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/tiff.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 0998aa1302..45d3e1ded0 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -905,6 +905,11 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
break;
case TIFF_STRIP_OFFS:
if (count == 1) {
+ if (value > INT_MAX) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "strippos %u too large\n", value);
+ return AVERROR_INVALIDDATA;
+ }
s->strippos = 0;
s->stripoff = value;
} else
@@ -916,6 +921,11 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
break;
case TIFF_STRIP_SIZE:
if (count == 1) {
+ if (value > INT_MAX) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "stripsize %u too large\n", value);
+ return AVERROR_INVALIDDATA;
+ }
s->stripsizesoff = 0;
s->stripsize = value;
s->strips = 1;