vtn: fix use-after-free on function parameter names

Fixes: 5d7a230324 ("vtn: gather function parameter names")
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35098>
(cherry picked from commit abbb0c0125)
This commit is contained in:
Karol Herbst 2025-05-22 12:15:08 +02:00 committed by Eric Engestrom
parent a26e7f4624
commit d1525e8c2b
2 changed files with 2 additions and 2 deletions

View file

@ -4984,7 +4984,7 @@
"description": "vtn: fix use-after-free on function parameter names",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "5d7a2303243a32f47d402e3335b16967b49a1362",
"notes": null

View file

@ -401,7 +401,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
struct vtn_ssa_value *ssa = vtn_create_ssa_value(b, type->type);
struct vtn_value *val = vtn_untyped_value(b, w[2]);
b->func->nir_func->params[b->func_param_idx].name = val->name;
b->func->nir_func->params[b->func_param_idx].name = ralloc_strdup(b->shader, val->name);
vtn_foreach_decoration(b, val, function_parameter_decoration_cb, &arg_info);
vtn_ssa_value_load_function_param(b, ssa, type, &arg_info, &b->func_param_idx);