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

Elie Tournier tournier.elie at gmail.com
Thu Jul 19 13:39:57 UTC 2018


On Wed, Jul 04, 2018 at 10:45:33AM +0200, Tomeu Vizoso wrote:
> 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>
Reviewed-by: Elie Tournier <elie.tournier 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
> 
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel


More information about the virglrenderer-devel mailing list