zink: Use memmove when dealing with overlapping memory

Fix defect reported by Coverity Scan.

Overlapping buffer in memory copy

Results in an undefined behavior

CID: 1515598

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26922>
This commit is contained in:
Corentin Noël
2024-01-08 12:12:13 +01:00
committed by Marge Bot
parent a18171968c
commit 1279e7b6c7

View File

@@ -234,7 +234,7 @@ zink_clear(struct pipe_context *pctx,
*/
add_new_clear(fb_clear);
struct zink_framebuffer_clear_data *clear = fb_clear->clears.data;
memcpy(clear + 1, clear, num_clears);
memmove(clear + 1, clear, num_clears);
memcpy(&clear->color, &color, sizeof(color));
} else {
/* no void clear needed */