1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/jpeg2000dec: check that tp_end is after the start

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-06-21 00:31:00 +02:00
parent 03cd3bec6e
commit 32fc8d6db6

View File

@ -1237,6 +1237,10 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
tile = s->tile + s->curtileno; tile = s->tile + s->curtileno;
tp = tile->tile_part + tile->tp_idx; tp = tile->tile_part + tile->tp_idx;
if (tp->tp_end < s->g.buffer) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid tpend\n");
return AVERROR_INVALIDDATA;
}
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);