[Mesa-dev] [PATCH 1/4] draw/gs: fix allocation of buffer for GS output vertices
Zack Rusin
zackr at vmware.com
Thu Feb 28 13:20:47 PST 2013
From: Bryan Cain <bryancain3 at gmail.com>
Before, it accounted for the size of the vertices but not the other fields
in the vertex_header struct, which caused memory corruption.
Reviewed-by: Zack Rusin <zackr at vmware.com>
---
src/gallium/auxiliary/draw/draw_gs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 5c55523..2ce1a2a 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -401,7 +401,8 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
output_verts->vertex_size = input_verts->vertex_size;
output_verts->stride = input_verts->vertex_size;
output_verts->verts =
- (struct vertex_header *)MALLOC(input_verts->vertex_size *
+ (struct vertex_header *)MALLOC(sizeof(struct vertex_header) +
+ input_verts->vertex_size *
num_in_primitives *
shader->max_output_vertices);
--
1.7.10.4
More information about the mesa-dev
mailing list