diff options
author | Dave Airlie <[email protected]> | 2020-06-19 16:18:22 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2020-07-08 06:06:05 +1000 |
commit | 690238ff564ecb4f9dcfdfd61a9c36a8447cc863 (patch) | |
tree | 5c38a7468a8261e82e110d598f733178118562de | |
parent | 21b903dd7d9df64d175ef216e580b419d74cee1e (diff) |
gallivm/nir: don't access stream var outside bounds
Since we allocate only enough for streams we see, don't access
out of bounds when streams are given
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index a8b7d0dd86e..7da701f06d8 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -1593,6 +1593,8 @@ static void emit_vertex(struct lp_build_nir_context *bld_base, uint32_t stream_i struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base; LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder; + if (stream_id >= bld->gs_vertex_streams) + return; assert(bld->gs_iface->emit_vertex); LLVMValueRef total_emitted_vertices_vec = LLVMBuildLoad(builder, bld->total_emitted_vertices_vec_ptr[stream_id], ""); @@ -1617,6 +1619,8 @@ end_primitive_masked(struct lp_build_nir_context * bld_base, struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base; LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder; + if (stream_id >= bld->gs_vertex_streams) + return; struct lp_build_context *uint_bld = &bld_base->uint_bld; LLVMValueRef emitted_vertices_vec = LLVMBuildLoad(builder, bld->emitted_vertices_vec_ptr[stream_id], ""); |