aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-22 20:21:05 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-23 03:05:33 +0200
commit220ee7e58369b0d6f3adf97242034f315b9a9d96 (patch)
tree26b4f2af92c26d53b309602bbe507aefb6e4bec7
parent9bca2f698bbccb6304aa389f70b234c996ea7aac (diff)
downloadffmpeg-220ee7e58369b0d6f3adf97242034f315b9a9d96.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 da0a5353a0..da422c1459 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1289,6 +1289,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
@@ -1309,7 +1311,6 @@ static int decode_frame(AVCodecContext *avctx,
return ret;
break;
}
- dst += s->rps * stride;
}
if (s->predictor == 2) {
if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) {