media/libspeex_resampler/set-rate-overflow-no-return.patch
author Mozilla Releng Treescript <release+treescript@mozilla.org>
Fri, 10 May 2019 15:09:31 +0000
changeset 523535 1f9a5b1354ea840190d60e025c7967d862df0d03
parent 395266 c8df499e005abc1438c394dfa72257e369097d7d
permissions -rw-r--r--
No bug - Tagging 9c4cd169d5d07b75453e6574e13bf4f912814fb0 with FIREFOX_67_0b19_RELEASE a=release CLOSED TREE DONTBUILD

diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/src/resample.c
--- a/media/libspeex_resampler/src/resample.c
+++ b/media/libspeex_resampler/src/resample.c
@@ -1141,18 +1141,19 @@ EXPORT int speex_resampler_set_rate_frac
 
    st->num_rate /= fact;
    st->den_rate /= fact;
 
    if (old_den > 0)
    {
       for (i=0;i<st->nb_channels;i++)
       {
-         if (_muldiv(&st->samp_frac_num[i],st->samp_frac_num[i],st->den_rate,old_den) != RESAMPLER_ERR_SUCCESS)
-            return RESAMPLER_ERR_OVERFLOW;
+         if (_muldiv(&st->samp_frac_num[i],st->samp_frac_num[i],st->den_rate,old_den) != RESAMPLER_ERR_SUCCESS) {
+           st->samp_frac_num[i] = st->den_rate-1;
+         }
          /* Safety net */
          if (st->samp_frac_num[i] >= st->den_rate)
             st->samp_frac_num[i] = st->den_rate-1;
       }
    }
 
    if (st->initialised)
       return update_filter(st);