1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

swscale/ops_tmpl_int: fix signed integer related UB when shifting values

Fixes:
src/libswscale/ops_tmpl_int.c:292:23: runtime error: left shift of 188 by 24 places cannot be represented in type 'int'
src/libswscale/ops_tmpl_int.c:290:23: runtime error: left shift of 158 by 24 places cannot be represented in type 'int'
src/libswscale/ops_tmpl_int.c:293:23: runtime error: left shift of 136 by 24 places cannot be represented in type 'int'
src/libswscale/ops_tmpl_int.c:291:23: runtime error: left shift of 160 by 24 places cannot be represented in type 'int'

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2025-11-20 23:49:07 -03:00
parent 30d66be21a
commit 06b3a20761

View File

@@ -287,10 +287,10 @@ DECL_PATTERN(expand32)
SWS_LOOP
for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
x32[i] = x[i] << 24 | x[i] << 16 | x[i] << 8 | x[i];
y32[i] = y[i] << 24 | y[i] << 16 | y[i] << 8 | y[i];
z32[i] = z[i] << 24 | z[i] << 16 | z[i] << 8 | z[i];
w32[i] = w[i] << 24 | w[i] << 16 | w[i] << 8 | w[i];
x32[i] = (uint32_t)x[i] << 24 | x[i] << 16 | x[i] << 8 | x[i];
y32[i] = (uint32_t)y[i] << 24 | y[i] << 16 | y[i] << 8 | y[i];
z32[i] = (uint32_t)z[i] << 24 | z[i] << 16 | z[i] << 8 | z[i];
w32[i] = (uint32_t)w[i] << 24 | w[i] << 16 | w[i] << 8 | w[i];
}
CONTINUE(u32block_t, x32, y32, z32, w32);