[FFmpeg-devel] [PATCH 1/5] libavcodec/jpeg2000.c: Precinct size check removed

Michael Niedermayer michael at niedermayer.cc
Sun Jun 28 21:56:04 EEST 2020


On Sat, Jun 27, 2020 at 09:14:26PM +0530, Gautam Ramakrishnan wrote:
> On Sat, Jun 27, 2020 at 7:36 PM Michael Niedermayer
> <michael at niedermayer.cc> wrote:
> >
> > On Sat, Jun 27, 2020 at 04:49:49PM +0530, Gautam Ramakrishnan wrote:
> > > On Sat, Jun 27, 2020 at 3:13 PM Michael Niedermayer
> > > <michael at niedermayer.cc> wrote:
> > > >
> > > > On Mon, Jun 22, 2020 at 12:12:04AM +0530, gautamramk at gmail.com wrote:
> > > > > From: Gautam Ramakrishnan <gautamramk at gmail.com>
> > > > >
> > > > > This patch removes a check which throws an error if
> > > > > the log2 precinct width/height is 0. The standard allows
> > > > > the first component to have 0 as the log2 width/height.
> > > > > ---
> > > > >  libavcodec/jpeg2000.c | 3 ---
> > > > >  1 file changed, 3 deletions(-)
> > > > >
> > > > > diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
> > > > > index 73206d17f3..1aca31ffa4 100644
> > > > > --- a/libavcodec/jpeg2000.c
> > > > > +++ b/libavcodec/jpeg2000.c
> > > > > @@ -509,9 +509,6 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
> > > > >          // update precincts size: 2^n value
> > > > >          reslevel->log2_prec_width  = codsty->log2_prec_widths[reslevelno];
> > > > >          reslevel->log2_prec_height = codsty->log2_prec_heights[reslevelno];
> > > > > -        if (!reslevel->log2_prec_width || !reslevel->log2_prec_height) {
> > > > > -            return AVERROR_INVALIDDATA;
> > > > > -        }
> > > >
> > > > This checked that log2_prec_width... has been initialized.
> > > > Is there some other check that ensures this is not just 0 from allocation
> > > > which IIUC is not an allowed path in the spec
> > >
> > > A check happens only when the COD and COC marker gets read.
> >
> > is there a check that protects against the absence of these markers ?
> >
> No, there is no check for this. Now I realize that this is an
> important check which is
> missing. Same would apply to other compulsory markers like the SIZ marker.
> Shall I add a check that would ensure that these markers are present before the
> tile part data starts?

yes

thanks

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200628/b4f5157f/attachment.sig>


More information about the ffmpeg-devel mailing list