Fix for overflow in iLBC code.
The calculation of the necessary number of shifts is not correct, leading to an overflow. Bug: chromium:1158070 Change-Id: I6545e9da46debf33ce169c33d762915fe755d606 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/197981 Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Commit-Queue: Ivo Creusen <ivoc@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32855}
This commit is contained in:
@ -202,10 +202,10 @@ size_t // (o) Estimated lag in end of in[]
|
|||||||
|
|
||||||
/* scaling */
|
/* scaling */
|
||||||
max16 = WebRtcSpl_MaxAbsValueW16(regressor, plc_blockl + 3 - 1);
|
max16 = WebRtcSpl_MaxAbsValueW16(regressor, plc_blockl + 3 - 1);
|
||||||
if (max16>5000)
|
|
||||||
shifts=2;
|
const int64_t max_val = plc_blockl * max16 * max16;
|
||||||
else
|
const int32_t factor = max_val >> 31;
|
||||||
shifts=0;
|
shifts = factor == 0 ? 0 : 31 - WebRtcSpl_NormW32(factor);
|
||||||
|
|
||||||
/* compute cross correlation */
|
/* compute cross correlation */
|
||||||
WebRtcSpl_CrossCorrelation(corr32, target, regressor, plc_blockl, 3, shifts,
|
WebRtcSpl_CrossCorrelation(corr32, target, regressor, plc_blockl, 3, shifts,
|
||||||
|
Reference in New Issue
Block a user