mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-23 10:30:23 +01:00
v3d: do not pass NULL pointer to function not expecting NULLs
memcpy() pointers arguments are declared to be non NULL. This has been detected by Undefined Behaviour Sanitizer (UBSan). Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29911>
This commit is contained in:
parent
417f70ef5a
commit
1bcf9c5da9
1 changed files with 9 additions and 5 deletions
|
|
@ -800,8 +800,10 @@ v3d_update_compiled_gs(struct v3d_context *v3d, uint8_t prim_mode)
|
|||
/* The last bin-mode shader in the geometry pipeline only outputs
|
||||
* varyings used by transform feedback.
|
||||
*/
|
||||
memcpy(key->used_outputs, uncompiled->tf_outputs,
|
||||
sizeof(*key->used_outputs) * uncompiled->num_tf_outputs);
|
||||
if (uncompiled->num_tf_outputs > 0) {
|
||||
memcpy(key->used_outputs, uncompiled->tf_outputs,
|
||||
sizeof(*key->used_outputs) * uncompiled->num_tf_outputs);
|
||||
}
|
||||
if (uncompiled->num_tf_outputs < key->num_used_outputs) {
|
||||
uint32_t size = sizeof(*key->used_outputs) *
|
||||
(key->num_used_outputs -
|
||||
|
|
@ -907,9 +909,11 @@ v3d_update_compiled_vs(struct v3d_context *v3d, uint8_t prim_mode)
|
|||
* gl_Position or TF outputs.
|
||||
*/
|
||||
if (!v3d->prog.bind_gs) {
|
||||
memcpy(key->used_outputs, shader_state->tf_outputs,
|
||||
sizeof(*key->used_outputs) *
|
||||
shader_state->num_tf_outputs);
|
||||
if (shader_state->num_tf_outputs > 0) {
|
||||
memcpy(key->used_outputs, shader_state->tf_outputs,
|
||||
sizeof(*key->used_outputs) *
|
||||
shader_state->num_tf_outputs);
|
||||
}
|
||||
if (shader_state->num_tf_outputs < key->num_used_outputs) {
|
||||
uint32_t tail_bytes =
|
||||
sizeof(*key->used_outputs) *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue