Commit e2298b3f authored by Paul B Mahol's avatar Paul B Mahol

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: 's avatarPaul B Mahol <onemda@gmail.com>
parent 4d251723
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment