[FFmpeg-devel] [PATCH] aacsbr_fixed: prevent sbr gain from being zero

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Wed Nov 23 00:23:52 EET 2016


On 13.11.2016 21:29, Andreas Cadhalpun wrote:
> It causes division by zero crashes.
> 
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
>  libavcodec/aacsbr_fixed.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
> index b26314a..d2a7027 100644
> --- a/libavcodec/aacsbr_fixed.c
> +++ b/libavcodec/aacsbr_fixed.c
> @@ -429,6 +429,10 @@ static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
>                                                  av_add_sf(FLOAT_1, sbr->e_curr[e][m]),
>                                                  av_add_sf(FLOAT_1, sbr->q_mapped[e][m]))));
>                  }
> +                if (sbr->gain[e][m].mant == 0) {
> +                    sbr->gain[e][m] = FLOAT_1;
> +                    sbr->gain[e][m].exp = MIN_EXP;
> +                }
>              }
>              for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
>                  sum[0] = av_add_sf(sum[0], sbr->e_origmapped[e][m]);
> 

Ping. It would be good to have this fixed in 3.2.1.

Best regards,
Andreas


More information about the ffmpeg-devel mailing list