media/libspeex_resampler/set-rate-overflow-no-return.patch
author Paul Adenot <paul@paul.cx>
Mon, 06 Mar 2017 17:16:23 +0100
changeset 347149 c8df499e005abc1438c394dfa72257e369097d7d
parent 347148 4b1b4e0d85790a4cc752993c1cbf12e4a4ce0e3d
permissions -rw-r--r--
Bug 1341254 - Update libspeex_resampler to 79822c. r=karlt MozReview-Commit-ID: EDYCyjrWmz1

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);