aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-03-25 11:22:39 +0100
committerPaul B Mahol <onemda@gmail.com>2016-03-25 22:00:52 +0100
commite2298b3fccde6aeaacf97912e4f2afe2d3548e00 (patch)
tree0c423d7e1b595cda938cad9c765185a91a830f05
parent4d251723c0a157b77fa9d3c84c74507d399f7254 (diff)
downloadffmpeg-e2298b3fccde6aeaacf97912e4f2afe2d3548e00.tar.gz
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>
-rw-r--r--libavcodec/jpeg2000dec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index c13670e6d6..962b7bc79c 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -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;
}