[virglrenderer-devel] [PATCH] Fix NULL dereference in vrend_draw_bind_samplers_shader

Tomeu Vizoso tomeu.vizoso at collabora.com
Wed Jul 4 08:45:33 UTC 2018


vrend_sub_context.views.views can be set to NULL on user error in
vrend_set_single_sampler_view.

 #0  vrend_draw_bind_samplers_shader ()
 #1  vrend_draw_bind_objects ()
 #2  vrend_draw_vbo ()
 #3  vrend_decode_draw_vbo ()
 #4  vrend_decode_block ()
 #5  virgl_renderer_submit_cmd ()
 #6  virgl_cmd_submit_3d ()

Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
---
 src/vrend_renderer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 17c10db8abc8..18e63e4f6db6 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -3040,6 +3040,9 @@ static void vrend_draw_bind_samplers_shader(struct vrend_context *ctx,
    for (int i = 0; i < ctx->sub->views[shader_type].num_views; i++) {
       struct vrend_sampler_view *tview = ctx->sub->views[shader_type].views[i];
 
+      if (!tview)
+         continue;
+
       if (!(ctx->sub->prog->samplers_used_mask[shader_type] & (1 << i)))
          continue;
 
-- 
2.17.1



More information about the virglrenderer-devel mailing list