mirror of
https://github.com/librempeg/librempeg
synced 2024-11-23 11:39:47 +00:00
avcodec/jpeg2000dec: Check Psot
Fixes out of array read Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
a75d2a6505
commit
5deb96c564
@ -469,6 +469,10 @@ static int get_sot(Jpeg2000DecoderContext *s, int n)
|
|||||||
/* Read TNSot but not used */
|
/* Read TNSot but not used */
|
||||||
bytestream2_get_byteu(&s->g); // TNsot
|
bytestream2_get_byteu(&s->g); // TNsot
|
||||||
|
|
||||||
|
if (Psot > bytestream2_get_bytes_left(&s->g) + n + 2) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "Psot %d too big\n", Psot);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
if (TPsot >= FF_ARRAY_ELEMS(s->tile[s->curtileno].tile_part)) {
|
if (TPsot >= FF_ARRAY_ELEMS(s->tile[s->curtileno].tile_part)) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "TPsot %d too big\n", TPsot);
|
av_log(s->avctx, AV_LOG_ERROR, "TPsot %d too big\n", TPsot);
|
||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
|
Loading…
Reference in New Issue
Block a user