summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Isorce <[email protected]>2017-03-10 17:16:07 +0000
committerMarek Olšák <[email protected]>2017-03-13 17:20:21 +0100
commit9df3f28a8bad8892edb114c49b5ed18e555488f9 (patch)
tree2a9e708e30a34abc2ad397a731e64f8e367e30c0
parentd08c0930af8aaef5bdf80df618bb906e0b349830 (diff)
gallium/hud: check NULL return from u_upload_alloc
Fixes the following segmentation fault: signal SIGSEGV: invalid address (fault address: 0x0) frame #0: 0x00007fffe718e117 radeonsi_dri.so hud_draw_background_quad hud_context.c:170 167 168 assert(hud->bg.num_vertices + 4 <= hud->bg.max_num_vertices); 169 -> 170 vertices[num++] = (float) x1; 171 vertices[num++] = (float) y1; 172 173 vertices[num++] = (float) x1; (lldb) bt * frame #0: 0x00007fffe718e117 radeonsi_dri.so`hud_draw_background_quad frame #1: 0x00007fffe718f458 radeonsi_dri.so`hud_draw frame #2: 0x00007fffe712967f radeonsi_dri.so`dri_flush Signed-off-by: Marek Olšák <[email protected]>
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index c44f8c01a31..29ef9eee31c 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -581,6 +581,10 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
hud->color_prims.buffer_size,
16, &hud->bg.vbuf.buffer_offset, &hud->bg.vbuf.buffer,
(void**)&hud->bg.vertices);
+ if (!hud->bg.vertices) {
+ goto out;
+ }
+
pipe_resource_reference(&hud->whitelines.vbuf.buffer, hud->bg.vbuf.buffer);
pipe_resource_reference(&hud->text.vbuf.buffer, hud->bg.vbuf.buffer);
pipe_resource_reference(&hud->color_prims.vbuf.buffer, hud->bg.vbuf.buffer);
@@ -690,6 +694,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
hud_pane_draw_colored_objects(hud, pane);
}
+out:
cso_restore_state(cso);
cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX);