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

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat Mar 28 13:28:52 EET 2020


Am Sa., 28. März 2020 um 12:13 Uhr schrieb Gautam Ramakrishnan
<gautamramk at gmail.com>:
>
> On Sat, Mar 28, 2020 at 3:54 PM Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> >
> > Am Sa., 28. März 2020 um 05:19 Uhr schrieb <gautamramk at gmail.com>:
> > >
> > > From: Gautam Ramakrishnan <gautamramk at gmail.com>
> > >
> > > This patch allows decoding of j2k streams which do
> > > not have an EOC marker. OpenJPEG implements a similar
> > > check.
> > > ---
> > >  libavcodec/jpeg2000dec.c | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > > index 44b3e7e41b..99fcb2cf68 100644
> > > --- a/libavcodec/jpeg2000dec.c
> > > +++ b/libavcodec/jpeg2000dec.c
> > > @@ -2076,8 +2076,9 @@ 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;
> > > +            av_log(s->avctx, AV_LOG_WARNING, "Invalid len %d left=%d\n", len, bytestream2_get_bytes_left(&s->g));
> > > +            av_log(s->avctx, AV_LOG_WARNING, "Stream does not end with EOC.\n");
> > > +            return 0;
> >
> > The return value should depend on the "strictness" requested by the user,
> > grep for "EXPLODE".
> >
> I did not understand this point too well. Could you point out some example I
> could refer to?

Did you grep for "EXPLODE"?

> > As said, the first two patches are (imo) not ok, either merge them or split
> > them differently so that the first does not add an unused function but
> > only splits ("uselessly" but making the second patch easier to read) an
> > existing function.
> >
> Shall do that. What is your opinion on the third patch? Do you feel
> the fix is right?

Yes, I believe the same is done for jpeg.

Carl Eugen


More information about the ffmpeg-devel mailing list