diff mbox series

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

Message ID 20200330050632.17563-3-gautamramk@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,v7,1/3] libavcodec/jpeg2000dec.c: Split function and modify structs for PPM marker support
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Gautam Ramakrishnan March 30, 2020, 5:06 a.m. UTC
From: Gautam Ramakrishnan <gautamramk@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(-)

Comments

Moritz Barsnick March 30, 2020, 2:13 p.m. UTC | #1
On Mon, Mar 30, 2020 at 10:36:32 +0530, gautamramk@gmail.com wrote:
> +            av_log(s->avctx, AV_LOG_WARNING, "Mising EOC Marker.\n");

Typo: Missing

Moritz
Gautam Ramakrishnan March 30, 2020, 3:29 p.m. UTC | #2
On Mon, Mar 30, 2020 at 7:44 PM Moritz Barsnick <barsnick@gmx.net> wrote:
>
> On Mon, Mar 30, 2020 at 10:36:32 +0530, gautamramk@gmail.com wrote:
> > +            av_log(s->avctx, AV_LOG_WARNING, "Mising EOC Marker.\n");
>
> Typo: Missing
>
> Moritz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Hi Moritz,

Thanks for the review. Cannot believe so many mistakes!
I'll submit a v8.
diff mbox series

Patch

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) {