1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-29 05:57:37 +02:00

avcodec/x86/mpegvideoencdsp_init: Fix left shift of negative number

Uncovered by UBSan when running the mpegvideoencdsp checkasm
test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-10-21 12:11:55 +02:00
parent e442128944
commit 05b8608c76

View File

@@ -42,7 +42,7 @@ static int try_8x8basis_ssse3(const int16_t rem[64], const int16_t weight[64], c
x86_reg i=0;
av_assert2(FFABS(scale) < MAX_ABS);
scale <<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
scale *= 1 << (16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT);
__asm__ volatile(
"pxor %%xmm2, %%xmm2 \n\t"
@@ -87,7 +87,7 @@ static void add_8x8basis_ssse3(int16_t rem[64], const int16_t basis[64], int sca
x86_reg i=0;
if (FFABS(scale) < 1024) {
scale <<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
scale *= 1 << (16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT);
__asm__ volatile(
"movd %3, %%xmm2 \n\t"
"punpcklwd %%xmm2, %%xmm2 \n\t"