diff --git a/.pick_status.json b/.pick_status.json index e8ac127a920..82cf9489ec4 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3883,7 +3883,7 @@ "description": "pipe-loader: avoid undefined memcpy behavior", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c index 1c58eaefd04..5b69599ee4f 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c @@ -97,8 +97,12 @@ merge_driconf(const driOptionDescription *driver_driconf, unsigned driver_count, return NULL; } - memcpy(merged, gallium_driconf, sizeof(*merged) * gallium_count); - memcpy(&merged[gallium_count], driver_driconf, sizeof(*merged) * driver_count); + if (gallium_count) + memcpy(merged, gallium_driconf, sizeof(*merged) * gallium_count); + if (driver_count) { + memcpy(&merged[gallium_count], driver_driconf, + sizeof(*merged) * driver_count); + } *merged_count = driver_count + gallium_count; return merged;