mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/tpf: Avoid reading constant value components beyond type's width (Valgrind).
We are passing map writemasks that may have more components than the constant's data type, so a (j < width) check is added to avoid reading components from the constant that are not intended to be used. Remaining values in the register are initialized to zero.
This commit is contained in:
parent
89eda51855
commit
ed9e236b01
Notes:
Alexandre Julliard
2023-08-24 23:12:11 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/308
@ -3715,8 +3715,10 @@ static void sm4_src_from_constant_value(struct sm4_src_register *src,
|
||||
src->reg.dim = VKD3D_SM4_DIMENSION_VEC4;
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
if (map_writemask & (1u << i))
|
||||
if ((map_writemask & (1u << i)) && (j < width))
|
||||
src->reg.immconst_uint[i] = value->u[j++].u;
|
||||
else
|
||||
src->reg.immconst_uint[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user