From 005551b530c9e3d08f98146662c9fd5f8dd938bd Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Wed, 23 Apr 2025 00:54:16 +0200 Subject: [PATCH] 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. --- AK/Span.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/Span.h b/AK/Span.h index 544e8c0ce4a..7ef28c62aea 100644 --- a/AK/Span.h +++ b/AK/Span.h @@ -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); }