Browse Source

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 27f80ab016)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.3.3
Michael Niedermayer 8 years ago
parent
commit
f1116294aa
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libavcodec/tiff.c

+ 2
- 1
libavcodec/tiff.c View File

@@ -1303,6 +1303,8 @@ static int decode_frame(AVCodecContext *avctx,
stride = p->linesize[plane]; stride = p->linesize[plane];
dst = p->data[plane]; dst = p->data[plane];
for (i = 0; i < s->height; i += s->rps) { for (i = 0; i < s->height; i += s->rps) {
if (i)
dst += s->rps * stride;
if (s->stripsizesoff) if (s->stripsizesoff)
ssize = ff_tget(&stripsizes, s->sstype, le); ssize = ff_tget(&stripsizes, s->sstype, le);
else else
@@ -1323,7 +1325,6 @@ static int decode_frame(AVCodecContext *avctx,
return ret; return ret;
break; break;
} }
dst += s->rps * stride;
} }
if (s->predictor == 2) { if (s->predictor == 2) {
if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) { if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) {


Loading…
Cancel
Save