Mesa (master): gallium/hud: prevent a crash if the recording context is inactive

Marek Olšák mareko at kemper.freedesktop.org
Sat Nov 25 16:17:09 UTC 2017


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Nov 19 04:36:38 2017 +0100

gallium/hud: prevent a crash if the recording context is inactive

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/gallium/auxiliary/hud/hud_context.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index e3fcad22f7..7502416c5b 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;




More information about the mesa-commit mailing list