summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-11-19 04:36:38 +0100
committerMarek Olšák <[email protected]>2017-11-25 17:16:56 +0100
commit9c5b4eb6b4ea46af274927a0af5907e996bcdcfe (patch)
treecd1b45b200aae59ebdb1b79fe9bd2a7c028f344f
parent37ded08321b81f8a9a145abd6e457e8ad2c088e1 (diff)
gallium/hud: prevent a crash if the recording context is inactive
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index e3fcad22f79..7502416c5b8 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -74,7 +74,10 @@ hud_draw_colored_prims(struct hud_context *hud, unsigned prim,
struct cso_context *cso = hud->cso;
unsigned size = num_vertices * hud->color_prims.vbuf.stride;
- assert(size <= hud->color_prims.buffer_size);
+ /* If a recording context is inactive, don't draw anything. */
+ if (size > hud->color_prims.buffer_size)
+ return;
+
memcpy(hud->color_prims.vertices, buffer, size);
hud->constants.color[0] = r;