[FFmpeg-cvslog] avcodec/jpeg2000dec: Fix potential integer overflow with tile dimensions
Michael Niedermayer
git at videolan.org
Sun Dec 6 12:57:20 CET 2015
ffmpeg | branch: release/2.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun Nov 15 21:17:05 2015 +0100| [f1058efc8160affedc90abd75245d6d96d9aa0e9] | committer: Michael Niedermayer
avcodec/jpeg2000dec: Fix potential integer overflow with tile dimensions
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 65d3359fb366ea265a8468d76a111cb7352f0b55)
Conflicts:
libavcodec/jpeg2000dec.c
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1058efc8160affedc90abd75245d6d96d9aa0e9
---
libavcodec/jpeg2000dec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index ab34df0..ee4f195 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -688,10 +688,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);
comp->coord[0][0] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], s->reduction_factor);
comp->coord[0][1] = ff_jpeg2000_ceildivpow2(comp->coord_o[0][1], s->reduction_factor);
More information about the ffmpeg-cvslog
mailing list