Module: Mesa Branch: staging/19.2 Commit: 91b99a04de3a1ab04c4f9d2cc6fe80234a1cca7b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=91b99a04de3a1ab04c4f9d2cc6fe80234a1cca7b
Author: Sergii Romantsov <[email protected]> Date: Thu Sep 12 15:28:45 2019 +0300 nir/large_constants: more careful data copying A filed of nir_variable.location may be equel to -1. That may cause copying to invalid address of list-node, making some internal fields corrupted. Patch fixes segfault during freeing context due to corrupted address of ralloc_header.destructor. v2: copy data if var is constant (Connor Abbott) CC: Caio Marcelo de Oliveira Filho <[email protected]> Fixes: b6d475356846 (nir/large_constants: De-duplicate constants) Signed-off-by: Sergii Romantsov <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111676 Reviewed-by: Connor Abbott <[email protected]> (cherry picked from commit c7b2a2fd363f57bb1ab4d7d6bad786af7e2924ef) --- src/compiler/nir/nir_opt_large_constants.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_opt_large_constants.c b/src/compiler/nir/nir_opt_large_constants.c index fae4ed27960..8fd1f0d2e99 100644 --- a/src/compiler/nir/nir_opt_large_constants.c +++ b/src/compiler/nir/nir_opt_large_constants.c @@ -318,7 +318,7 @@ nir_opt_large_constants(nir_shader *shader, shader->constant_data = rzalloc_size(shader, shader->constant_data_size); for (int i = 0; i < num_locals; i++) { struct var_info *info = &var_infos[i]; - if (!info->duplicate) { + if (!info->duplicate && info->is_constant) { memcpy((char *)shader->constant_data + info->var->data.location, info->constant_data, info->constant_data_size); } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
