You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
jpeg2000dec: Check that theres a SOT before SOD
Fixes out of array access Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -1208,9 +1208,16 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
|
|||||||
oldpos = bytestream2_tell(&s->g);
|
oldpos = bytestream2_tell(&s->g);
|
||||||
|
|
||||||
if (marker == JPEG2000_SOD) {
|
if (marker == JPEG2000_SOD) {
|
||||||
Jpeg2000Tile *tile = s->tile + s->curtileno;
|
Jpeg2000Tile *tile;
|
||||||
Jpeg2000TilePart *tp = tile->tile_part + tile->tp_idx;
|
Jpeg2000TilePart *tp;
|
||||||
|
|
||||||
|
if (s->curtileno < 0) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "Missing SOT\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
tile = s->tile + s->curtileno;
|
||||||
|
tp = tile->tile_part + tile->tp_idx;
|
||||||
bytestream2_init(&tp->tpg, s->g.buffer, tp->tp_end - s->g.buffer);
|
bytestream2_init(&tp->tpg, s->g.buffer, tp->tp_end - s->g.buffer);
|
||||||
bytestream2_skip(&s->g, tp->tp_end - s->g.buffer);
|
bytestream2_skip(&s->g, tp->tp_end - s->g.buffer);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user