virgl: Fix stack overflow in virgl_bind_sampler_states
authorTim Pambor <tp@osasysteme.de>
Thu, 15 Jun 2023 15:06:28 +0000 (15:06 +0000)
committerMarge Bot <emma+marge@anholt.net>
Fri, 16 Jun 2023 07:34:41 +0000 (07:34 +0000)
Triggered on hosts with more than 32 samplers.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9207
Fixes: 63c4c559 ("virgl: obtain supported number of shader sampler views from host")
Signed-off-by: Tim Pambor <tp@osasysteme.de>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23678>

src/gallium/drivers/virgl/virgl_context.c

index 983f52f..751561c 100644 (file)
@@ -1181,7 +1181,7 @@ static void virgl_bind_sampler_states(struct pipe_context *ctx,
                                      void **samplers)
 {
    struct virgl_context *vctx = virgl_context(ctx);
-   uint32_t handles[32];
+   uint32_t handles[PIPE_MAX_SHADER_SAMPLER_VIEWS];
    int i;
    for (i = 0; i < num_samplers; i++) {
       handles[i] = (unsigned long)(samplers[i]);