mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
AK: Don't call memcpy with null argument in ByteBuffer::copy()
This was happening in TestBase64.test_decode, while copying an empty string.
This commit is contained in:
parent
00fa5dc53e
commit
11214bc94d
Notes:
sideshowbarker
2024-07-18 17:59:56 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/11214bc94d3 Pull-request: https://github.com/SerenityOS/serenity/pull/7157 Issue: https://github.com/SerenityOS/serenity/issues/7073 Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/metmo
1 changed files with 2 additions and 1 deletions
|
@ -74,7 +74,8 @@ public:
|
|||
[[nodiscard]] static ByteBuffer copy(void const* data, size_t size)
|
||||
{
|
||||
auto buffer = create_uninitialized(size);
|
||||
__builtin_memcpy(buffer.data(), data, size);
|
||||
if (size != 0)
|
||||
__builtin_memcpy(buffer.data(), data, size);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue