AK: Fix out of bound access check in Span::overwrite()

Previously `data_size` (in bytes) was mistakenly compared with `size()`
that returns number of elements in a span.
This commit is contained in:
Aliaksandr Kalenik 2025-04-23 00:54:16 +02:00 committed by Andreas Kling
commit 005551b530
Notes: github-actions[bot] 2025-04-24 08:32:46 +00:00

View file

@ -186,7 +186,7 @@ public:
ALWAYS_INLINE constexpr void overwrite(size_t offset, void const* data, size_t data_size)
{
// make sure we're not told to write past the end
VERIFY(offset + data_size <= size());
VERIFY(offset + data_size <= size() * sizeof(T));
__builtin_memmove(this->data() + offset, data, data_size);
}