1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

avcodec/jpeg2000dec: account two last bytes from end of bytestream as EOC marker

This silences missing EOC marker when decoding j2k files with Psot set to 0.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol
2016-03-25 11:22:39 +01:00
parent 4d251723c0
commit e2298b3fcc

View File

@@ -737,9 +737,9 @@ static int get_sot(Jpeg2000DecoderContext *s, int n)
bytestream2_get_byteu(&s->g); // TNsot
if (!Psot)
Psot = bytestream2_get_bytes_left(&s->g) + n + 2;
Psot = bytestream2_get_bytes_left(&s->g) - 2 + n + 2;
if (Psot > bytestream2_get_bytes_left(&s->g) + n + 2) {
if (Psot > bytestream2_get_bytes_left(&s->g) - 2 + n + 2) {
av_log(s->avctx, AV_LOG_ERROR, "Psot %"PRIu32" too big\n", Psot);
return AVERROR_INVALIDDATA;
}