[Mesa-dev] [PATCH] mesa/st: Avoid a NULL-ptr dereference on possible missing callback

Ilia Mirkin imirkin at alum.mit.edu
Mon Mar 28 05:08:58 UTC 2016


When would that happen? When a user force-enables
ARB_query_buffer_object for a driver that's not ready for it? Is
hitting a deterministic assert in that case any better than hitting a
null deref?

On Sun, Mar 27, 2016 at 11:52 PM, Edward O'Callaghan
<eocallaghan at alterapraxis.com> wrote:
> Just because we miss a gallium driver callback don't dereference
> invalid memory.
>
> Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
> ---
>  src/mesa/state_tracker/st_cb_queryobj.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c
> index cdb9efc..e9abc38 100644
> --- a/src/mesa/state_tracker/st_cb_queryobj.c
> +++ b/src/mesa/state_tracker/st_cb_queryobj.c
> @@ -402,6 +402,7 @@ st_StoreQueryResult(struct gl_context *ctx, struct gl_query_object *q,
>        index = 0;
>     }
>
> +   assert(pipe->get_query_result_resource);
>     pipe->get_query_result_resource(pipe, stq->pq, wait, result_type, index,
>                                     stObj->buffer, offset);
>  }
> --
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list