aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-22 20:21:05 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-07-19 15:26:37 +0200
commitf1116294aa3e63105b34f8b70a11146bc9f1e8ab (patch)
treeb146114da00f1f01a90b14054be6bb25b106ec65
parent0749384f0a7de0d03c2dbec99d58d33c4290b7eb (diff)
downloadffmpeg-f1116294aa3e63105b34f8b70a11146bc9f1e8ab.tar.gz
avcodec/tiff: Update pointer only when the result is used
Fixes: runtime error: signed integer overflow: 538976288 * 32 cannot be represented in type 'int' Fixes: 2310/clusterfuzz-testcase-minimized-4534784887881728 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 27f80ab0160d2e64007e1c9799ffd4504cc13eb5) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/tiff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 6d833cd992..78bae5d6d4 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1303,6 +1303,8 @@ static int decode_frame(AVCodecContext *avctx,
stride = p->linesize[plane];
dst = p->data[plane];
for (i = 0; i < s->height; i += s->rps) {
+ if (i)
+ dst += s->rps * stride;
if (s->stripsizesoff)
ssize = ff_tget(&stripsizes, s->sstype, le);
else
@@ -1323,7 +1325,6 @@ static int decode_frame(AVCodecContext *avctx,
return ret;
break;
}
- dst += s->rps * stride;
}
if (s->predictor == 2) {
if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) {