[FFmpeg-devel] [PATCH v7 3/3] libavcodec/jpeg2000dec.c: Handle non EOC streams

gautamramk at gmail.com gautamramk at gmail.com
Mon Mar 30 08:06:32 EEST 2020


From: Gautam Ramakrishnan <gautamramk at gmail.com>

This patch allows decoding of j2k streams which do
not have an EOC marker.
---
 libavcodec/jpeg2000dec.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 71f1245fc1..a319297ae7 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2080,8 +2080,12 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
 
         len = bytestream2_get_be16(&s->g);
         if (len < 2 || bytestream2_get_bytes_left(&s->g) < len - 2) {
-            av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", len, bytestream2_get_bytes_left(&s->g));
-            return AVERROR_INVALIDDATA;
+            if (s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
+                av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", len, bytestream2_get_bytes_left(&s->g));
+                return AVERROR_INVALIDDATA;
+            }
+            av_log(s->avctx, AV_LOG_WARNING, "Mising EOC Marker.\n");
+            break;
         }
 
         switch (marker) {
-- 
2.17.1



More information about the ffmpeg-devel mailing list