mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
AK+DHCPClient: Fix false positive gcc 12 warnings
The compiler would complain about `__builtin_memcpy` in ByteBuffer::copy writing out of bounds, as it isn't able to deduce the invariant that the inline buffer is only used when the requested size is smaller than the inline capacity. The other change is more bizarre. If the destructor's declaration exists, gcc complains about a `delete` operation causing an out-of-bounds array access. error: array subscript 'DHCPv4Client::__as_base [0]' is partly outside array bounds of 'unsigned char [8]' [-Werror=array-bounds] 14 | ~DHCPv4Client() = default; | ^ This looks like a compiler bug, and I'll report it if I find a suitable reduced reproducer.
This commit is contained in:
parent
f40b6fbd07
commit
014b9fd709
Notes:
sideshowbarker
2024-07-17 12:00:03 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/014b9fd709 Pull-request: https://github.com/SerenityOS/serenity/pull/13954 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/EWouters Reviewed-by: https://github.com/timschumi ✅
2 changed files with 2 additions and 2 deletions
|
@ -80,6 +80,8 @@ public:
|
|||
[[nodiscard]] static ErrorOr<ByteBuffer> copy(void const* data, size_t size)
|
||||
{
|
||||
auto buffer = TRY(create_uninitialized(size));
|
||||
if (buffer.m_inline && size > inline_capacity)
|
||||
__builtin_unreachable();
|
||||
if (size != 0)
|
||||
__builtin_memcpy(buffer.data(), data, size);
|
||||
return { move(buffer) };
|
||||
|
|
|
@ -40,8 +40,6 @@ class DHCPv4Client final : public Core::Object {
|
|||
C_OBJECT(DHCPv4Client)
|
||||
|
||||
public:
|
||||
virtual ~DHCPv4Client() override = default;
|
||||
|
||||
void dhcp_discover(InterfaceDescriptor const& ifname);
|
||||
void dhcp_request(DHCPv4Transaction& transaction, DHCPv4Packet const& packet);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue