1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/wavpackenc: Fix undefined shifts

Fixes ticket #8161 and the acodec-wavpack FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2019-09-20 00:16:58 +02:00 committed by Paul B Mahol
parent 525de95679
commit 84974c6fb5

View File

@ -529,9 +529,9 @@ static int8_t store_weight(int weight)
static int restore_weight(int8_t weight)
{
int result;
int result = 8 * weight;
if ((result = (int) weight << 3) > 0)
if (result > 0)
result += (result + 64) >> 7;
return result;
@ -2557,7 +2557,7 @@ static int wavpack_encode_block(WavPackEncodeContext *s,
ret = wv_mono(s, samples_l, !s->num_terms, 1);
} else {
for (i = 0; i < nb_samples; i++)
crc += (crc << 3) + (samples_l[i] << 1) + samples_l[i] + samples_r[i];
crc += (crc << 3) + ((uint32_t)samples_l[i] << 1) + samples_l[i] + samples_r[i];
if (s->num_passes)
ret = wv_stereo(s, samples_l, samples_r, !s->num_terms, 1);