diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-04-29 19:58:09 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-04-30 10:00:53 -0700 |
| commit | 1c9bb6a79de3ca52d819177fea32ce7993634e31 (patch) | |
| tree | b417567646e316854043f775ce6d5c01793153c3 /lib/std/Build/Step/WriteFile.zig | |
| parent | 956f53beb09c07925970453d4c178c6feb53ba70 (diff) | |
| download | zig-1c9bb6a79de3ca52d819177fea32ce7993634e31.tar.gz zig-1c9bb6a79de3ca52d819177fea32ce7993634e31.zip | |
C backend: avoid memcpy when len=0
As of Clang 18, calling memcpy() with a misaligned pointer trips UBSAN,
even if the length is zero. This unfortunately includes any call to
`@memcpy` when source or destination are undefined and the length is
zero.
This patch makes the C backend avoid calling memcpy when the length is
zero, thereby avoiding undefined behavior.
A zig1.wasm update will be needed in the llvm18 branch to activate this
code.
Diffstat (limited to 'lib/std/Build/Step/WriteFile.zig')
0 files changed, 0 insertions, 0 deletions
