mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
nir/serialize: Alloc constants off the variable
nir_sweep assumes that constants area always allocated off the variable
to which they belong. Violating this assumption causes them to get
freed early and leads to use-after-free bugs.
Fixes: 120da00975 "nir: add serialization and deserialization"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107366
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
This commit is contained in:
parent
7f95564a22
commit
f214baf72f
1 changed files with 1 additions and 1 deletions
|
|
@ -124,7 +124,7 @@ read_constant(read_ctx *ctx, nir_variable *nvar)
|
|||
|
||||
blob_copy_bytes(ctx->blob, (uint8_t *)c->values, sizeof(c->values));
|
||||
c->num_elements = blob_read_uint32(ctx->blob);
|
||||
c->elements = ralloc_array(ctx->nir, nir_constant *, c->num_elements);
|
||||
c->elements = ralloc_array(nvar, nir_constant *, c->num_elements);
|
||||
for (unsigned i = 0; i < c->num_elements; i++)
|
||||
c->elements[i] = read_constant(ctx, nvar);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue