[FFmpeg-cvslog] avcodec/jpeg2000dec: account two last bytes from end of bytestream as EOC marker

Paul B Mahol git at videolan.org
Fri Mar 25 22:14:28 CET 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Mar 25 11:22:39 2016 +0100| [e2298b3fccde6aeaacf97912e4f2afe2d3548e00] | committer: 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: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2298b3fccde6aeaacf97912e4f2afe2d3548e00
---

 libavcodec/jpeg2000dec.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index c13670e..962b7bc 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;
     }



More information about the ffmpeg-cvslog mailing list