[FFmpeg-devel] [PATCH] avcodec/jpeg2000dec: make SOC finding code more robust

Michael Niedermayer michaelni at gmx.at
Tue Jul 23 04:12:04 CEST 2013


Fixes file from Ticket860

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/jpeg2000dec.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index c6f6f6c..d59fb5f 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1623,6 +1623,9 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
         bytestream2_seek(&s->g, 0, SEEK_SET);
     }
 
+    while(bytestream2_get_bytes_left(&s->g) >= 3 && bytestream2_peek_be16(&s->g) != JPEG2000_SOC)
+        bytestream2_skip(&s->g, 1);
+
     if (bytestream2_get_be16u(&s->g) != JPEG2000_SOC) {
         av_log(avctx, AV_LOG_ERROR, "SOC marker not present\n");
         ret = AVERROR_INVALIDDATA;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list