Mesa (master): gallivm/draw: calloc prim id toavoid undef

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 15 04:49:32 UTC 2020


Module: Mesa
Branch: master
Commit: ccc6a48ec5be0a748d77d56168ba90e2784b0a33
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ccc6a48ec5be0a748d77d56168ba90e2784b0a33

Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Apr  8 15:43:47 2020 +1000

gallivm/draw: calloc prim id toavoid undef

Otherwise masked off channels can access random bad memory

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4560>

---

 src/gallium/auxiliary/draw/draw_gs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 9cfec4dcf11..0cbead3f9ac 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -880,7 +880,7 @@ draw_create_geometry_shader(struct draw_context *draw,
 
       gs->llvm_emitted_primitives = align_malloc(vector_size * PIPE_MAX_VERTEX_STREAMS, vector_size);
       gs->llvm_emitted_vertices = align_malloc(vector_size * PIPE_MAX_VERTEX_STREAMS, vector_size);
-      gs->llvm_prim_ids = align_malloc(vector_size, vector_size);
+      gs->llvm_prim_ids = align_calloc(vector_size, vector_size);
 
       gs->fetch_outputs = llvm_fetch_gs_outputs;
       gs->fetch_inputs = llvm_fetch_gs_input;



More information about the mesa-commit mailing list