On Tue, Apr 30, 2013 at 04:18:55PM +0200, Diego Biurrun wrote:
> On Tue, Apr 30, 2013 at 03:56:41PM +0200, Nicolas Bertrand wrote:
> > --- a/libavcodec/jpeg2000dec.c
> > +++ b/libavcodec/jpeg2000dec.c
> > @@ -251,12 +251,15 @@ static int get_cox(Jpeg2000DecoderContext *s, 
> > Jpeg2000CodingStyle *c)
> >  
> >      if (s->buf_end - s->buf < 5)
> >          return AVERROR(EINVAL);
> > -    c->nreslevels = bytestream_get_byte(&s->buf) + 1; // num of resolution 
> > levels - 1
> > +    c->nreslevels = bytestream_get_byte(&s->buf) + 1; // num of resolution 
> > levels
> >  
> >      /* compute number of resolution levels to decode */
> > -    if (c->nreslevels < s->reduction_factor)
> > -        c->nreslevels2decode = 1;
> > -    else
> > +    if (c->nreslevels <= s->reduction_factor) {
> > +        av_log(s->avctx, AV_LOG_ERROR,
> > +            "Cannot set lowres to %d, maximum lowres for this file is 
> > %d.\n",
> > +             s->reduction_factor, c->nreslevels - 1);
> 
> Indentation is off.
> 
> > +        return EINVAL;
> 
> That's not how we return EINVAL (look a few lines above).

I'd rather set reduction factor to whatever possible, warn user and continue
decoding.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to