aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/jpeg2000dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-15 21:17:05 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-15 21:39:18 +0100
commitca43c6e1f53af217f6192332570d006e1c1f7079 (patch)
tree7bf9d41f9e7ae2da3e08170e6cbded7d73ad0623 /libavcodec/jpeg2000dec.c
parent2deaccfe670e2c51d895951d2e1cb73b04c87e99 (diff)
downloadffmpeg-ca43c6e1f53af217f6192332570d006e1c1f7079.tar.gz
avcodec/jpeg2000dec: Fix potential integer overflow with tile dimensions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 65d3359fb366ea265a8468d76a111cb7352f0b55) Conflicts: libavcodec/jpeg2000dec.c
Diffstat (limited to 'libavcodec/jpeg2000dec.c')
-rw-r--r--libavcodec/jpeg2000dec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 34591c3cc2..caaf2f7614 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -709,10 +709,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int tileno)
Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;
int ret; // global bandno
- comp->coord_o[0][0] = av_clip(tilex * s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
- comp->coord_o[0][1] = av_clip((tilex + 1) * s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
- comp->coord_o[1][0] = av_clip(tiley * s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
- comp->coord_o[1][1] = av_clip((tiley + 1) * s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
+ comp->coord_o[0][0] = av_clip(tilex * (int64_t)s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
+ comp->coord_o[0][1] = av_clip((tilex + 1) * (int64_t)s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
+ comp->coord_o[1][0] = av_clip(tiley * (int64_t)s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
+ comp->coord_o[1][1] = av_clip((tiley + 1) * (int64_t)s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
if (compno) {
comp->coord_o[0][0] /= s->cdx[compno];
comp->coord_o[0][1] /= s->cdx[compno];