mesa: Fix stack corruption for PIPE_QUERY_TIMESTAMP

get_query_result expects a pointer to a union pipe_query_result,
which is larger than GLuint64EXT, causing the memset it does to
overwrite the stack.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19055>
This commit is contained in:
Giancarlo Devich 2022-10-12 13:28:41 -07:00 committed by Marge Bot
parent a0c52ee827
commit 6f598fe4e3

View file

@ -321,10 +321,9 @@ get_query_result(struct pipe_context *pipe,
if (q->Target == GL_TIME_ELAPSED &&
q->type == PIPE_QUERY_TIMESTAMP) {
/* Calculate the elapsed time from the two timestamp queries */
GLuint64EXT Result0 = 0;
assert(q->pq_begin);
pipe->get_query_result(pipe, q->pq_begin, TRUE, (void *)&Result0);
q->Result -= Result0;
pipe->get_query_result(pipe, q->pq_begin, TRUE, &data);
q->Result -= data.u64;
} else {
assert(!q->pq_begin);
}