zink: do not dereference null-pointer

The "locations" pointer can be null here, and memcpying from a null
pointer is not okay.

CID: 1485978

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
This commit is contained in:
Erik Faye-Lund 2021-08-26 00:09:44 +02:00 committed by Marge Bot
parent 3fde1c4242
commit 4cc3554d85

View File

@ -2059,7 +2059,9 @@ zink_set_sample_locations(struct pipe_context *pctx, size_t size, const uint8_t
ctx->sample_locations_changed = ctx->gfx_pipeline_state.sample_locations_enabled;
if (size > sizeof(ctx->sample_locations))
size = sizeof(ctx->sample_locations);
memcpy(ctx->sample_locations, locations, size);
if (locations)
memcpy(ctx->sample_locations, locations, size);
}
static VkAccessFlags