mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avcodec/jpeg2000dec: Clip all tile coordinates
Fixes out of array access Fixes: b877a6b788a25c70e8b1d014f8628549/asan_heap-oob_1da2c3f_2324_5a1b329b0b3c4bb6b1d775660ac56717.r3d Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 43492ff3ab68a343c1264801baa1d5a02de10167) Conflicts: libavcodec/jpeg2000dec.c
This commit is contained in:
parent
af3a608e7e
commit
169a02da1e
@ -705,10 +705,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int tileno)
|
||||
Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;
|
||||
int ret; // global bandno
|
||||
|
||||
comp->coord_o[0][0] = FFMAX(tilex * s->tile_width + s->tile_offset_x, s->image_offset_x);
|
||||
comp->coord_o[0][1] = FFMIN((tilex + 1) * s->tile_width + s->tile_offset_x, s->width);
|
||||
comp->coord_o[1][0] = FFMAX(tiley * s->tile_height + s->tile_offset_y, s->image_offset_y);
|
||||
comp->coord_o[1][1] = FFMIN((tiley + 1) * s->tile_height + s->tile_offset_y, s->height);
|
||||
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);
|
||||
if (compno) {
|
||||
comp->coord_o[0][0] /= s->cdx[compno];
|
||||
comp->coord_o[0][1] /= s->cdx[compno];
|
||||
|
Loading…
x
Reference in New Issue
Block a user