diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index 2876ee4dc5e..1b9e7821c77 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -13,6 +13,12 @@ #include #include +#ifdef AK_COMPILER_GCC +# pragma GCC diagnostic push +// GCC incorrectly claims that the size of the ByteBuffer is too small in some cases when UBSan is disabled. +# pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif + namespace AK { namespace Detail { @@ -286,15 +292,7 @@ public: { // make sure we're not told to write past the end VERIFY(offset + data_size <= size()); -#ifdef AK_COMPILER_GCC -# pragma GCC diagnostic push -// GCC incorrectly claims that the size of the ByteBuffer is too small in some cases on AArch64/RISC-V when UBSan is disabled. -# pragma GCC diagnostic ignored "-Wstringop-overflow" -#endif __builtin_memmove(this->data() + offset, data, data_size); -#ifdef AK_COMPILER_GCC -# pragma GCC diagnostic pop -#endif } void zero_fill() @@ -389,4 +387,8 @@ struct Traits : public DefaultTraits { } }; +#ifdef AK_COMPILER_GCC +# pragma GCC diagnostic pop +#endif + }