[FFmpeg-devel] [PATCH 1/3] avcodec/lpc: check for zero err in normalization in compute_lpc_coefs()

Michael Niedermayer michael at niedermayer.cc
Sat Jun 5 17:14:24 EEST 2021


On Sat, Jun 05, 2021 at 03:44:49PM +0200, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2021-06-01 09:33:13)
> > Fixes: floating point division by 0
> > Fixes: Ticket8213
> > 
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/lpc.h | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h
> > index 52170fd623..c99e568794 100644
> > --- a/libavcodec/lpc.h
> > +++ b/libavcodec/lpc.h
> > @@ -186,7 +186,8 @@ static inline int AAC_RENAME(compute_lpc_coefs)(const LPC_TYPE *autoc, int max_o
> >              for(j=0; j<i; j++)
> >                  r -= lpc_last[j] * autoc[i-j-1];
> >  
> > -            r /= err;
> > +            if (r || err)
> 
> Why check for non-zero r?

The idea was to make it clear what the case was that this checked for
i can drop the r check if you prefer ?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- 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/20210605/4b16373b/attachment.sig>


More information about the ffmpeg-devel mailing list