From 80572a6fbc420f50f8afdd849b615aa2ffcd4626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sun, 15 Oct 2023 21:00:01 +0200 Subject: [PATCH] audioconvert: don't left shift negative values See #3572 --- spa/plugins/audioconvert/fmt-ops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/plugins/audioconvert/fmt-ops.h b/spa/plugins/audioconvert/fmt-ops.h index e5f1b62e3..c8d1d5262 100644 --- a/spa/plugins/audioconvert/fmt-ops.h +++ b/spa/plugins/audioconvert/fmt-ops.h @@ -155,7 +155,7 @@ static inline uint24_t u32_to_u24(uint32_t src) static inline int32_t s24_to_s32(int24_t src) { - return ((int32_t)src.v1 << 16) | ((uint32_t)src.v2 << 8) | (uint32_t)src.v3; + return ((uint32_t)((int32_t)src.v1 & 0xFFFF) << 16) | ((uint32_t)src.v2 << 8) | (uint32_t)src.v3; } #define S32_TO_S24(s) (int24_t) { .v1 = (int8_t)(((int32_t)s) >> 16), \