aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-03-16 02:00:17 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-16 16:00:22 +0200
commit91f821ed5d55e150c64d2b9b07800ba180668bb5 (patch)
tree1a1557616b6f7f0d654091ff578543843adc029a
parentf4b8e7f2c692f8d9d06d107e8f042a8523c3be6c (diff)
downloadffmpeg-91f821ed5d55e150c64d2b9b07800ba180668bb5.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 ecafd2ddf1..70e34b469d 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -904,6 +904,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
@@ -915,6 +920,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;