mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
enc_sse2: prevent signed int overflow
_mm_movemask_epi8 returns a 16-bit mask; << 16 can overflow a signed int. Change-Id: Ia0bb0804fe548fb9b0edb3695e82727506066cda
This commit is contained in:
parent
3fdaf4d28c
commit
db4860b355
@ -949,7 +949,7 @@ void VP8SetResidualCoeffsSSE2(const int16_t* const coeffs,
|
||||
// are not equal to zero. Finally, mask out least significant bits according
|
||||
// to res->first.
|
||||
const uint32_t mask =
|
||||
~((_mm_movemask_epi8(m1) << 16) | _mm_movemask_epi8(m0)) &
|
||||
~(((uint32_t)_mm_movemask_epi8(m1) << 16) | _mm_movemask_epi8(m0)) &
|
||||
-(1U << (res->first << 1));
|
||||
// The position of the most significant non-zero bit indicates the position of
|
||||
// the last non-zero value. Divide the result by two because __movemask_epi8
|
||||
|
Loading…
Reference in New Issue
Block a user