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:36:19 +0100
commit65d3359fb366ea265a8468d76a111cb7352f0b55 (patch)
tree693560c12f2045b8e0a75a1b9eea4ecd4fc59e32 /libavcodec/jpeg2000dec.c
parent6ef819c40bcc2175edba7ce9e20c3036c01b36b9 (diff)
downloadffmpeg-65d3359fb366ea265a8468d76a111cb7352f0b55.tar.gz
avcodec/jpeg2000dec: Fix potential integer overflow with tile dimensions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
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 06cf4b7510..4604e73c75 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -830,10 +830,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int tileno)
if (!tile->comp)
return AVERROR(ENOMEM);
- tile->coord[0][0] = av_clip(tilex * s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
- tile->coord[0][1] = av_clip((tilex + 1) * s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
- tile->coord[1][0] = av_clip(tiley * s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
- tile->coord[1][1] = av_clip((tiley + 1) * s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
+ tile->coord[0][0] = av_clip(tilex * (int64_t)s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
+ tile->coord[0][1] = av_clip((tilex + 1) * (int64_t)s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
+ tile->coord[1][0] = av_clip(tiley * (int64_t)s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
+ tile->coord[1][1] = av_clip((tiley + 1) * (int64_t)s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
for (compno = 0; compno < s->ncomponents; compno++) {
Jpeg2000Component *comp = tile->comp + compno;