Fix UBSan errors (left shift of negative value, left shift overflows int)
BUG=chromium:603498 Review-Url: https://codereview.webrtc.org/1979973003 Cr-Commit-Position: refs/heads/master@{#12787}
This commit is contained in:
@ -214,10 +214,10 @@ int WebRtcIsac_DecHistOneStepMulti(int *data, /* output: data vector */
|
||||
if (streamdata->stream_index == 0) /* first time decoder is called for this stream */
|
||||
{
|
||||
/* read first word from bytestream */
|
||||
streamval = *stream_ptr << 24;
|
||||
streamval |= *++stream_ptr << 16;
|
||||
streamval |= *++stream_ptr << 8;
|
||||
streamval |= *++stream_ptr;
|
||||
streamval = (uint32_t)(*stream_ptr) << 24;
|
||||
streamval |= (uint32_t)(*++stream_ptr) << 16;
|
||||
streamval |= (uint32_t)(*++stream_ptr) << 8;
|
||||
streamval |= (uint32_t)(*++stream_ptr);
|
||||
} else {
|
||||
streamval = streamdata->streamval;
|
||||
}
|
||||
|
@ -162,9 +162,9 @@ static void FindInvArSpec(const int16_t* ARCoefQ12,
|
||||
}
|
||||
|
||||
for (k = 0; k < FRAMESAMPLES / 8; k++) {
|
||||
CurveQ16[FRAMESAMPLES_QUARTER - 1 - k] = CurveQ16[k] -
|
||||
(diffQ16[k] << shftVal);
|
||||
CurveQ16[k] += diffQ16[k] << shftVal;
|
||||
int32_t diff_q16_shifted = (int32_t)((uint32_t)(diffQ16[k]) << shftVal);
|
||||
CurveQ16[FRAMESAMPLES_QUARTER - 1 - k] = CurveQ16[k] - diff_q16_shifted;
|
||||
CurveQ16[k] += diff_q16_shifted;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user