On Sat, Mar 28, 2020 at 09:16:41PM +0530, gautamr...@gmail.com wrote:
> From: Gautam Ramakrishnan <gautamr...@gmail.com>
> 
> This patch allows decoding of j2k streams which do
> not have an EOC marker. OpenJPEG implements a similar
> check.
> ---
>  libavcodec/jpeg2000dec.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 55fab00152..4f923d620d 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -2078,8 +2078,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");

> +            return 0;

this should be the same as the other EOC handling is (break)
(makes no differences of course but its more consistent and if any code is
 added in the future it could become a bug)

 thx
 
[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to