From 6cb42d8a409b578138b17542bba4957bf8dc6ad7 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Sun, 24 Oct 2021 23:29:42 +0200 Subject: [PATCH] AK: Verify that we are not overreaching in StringView's substring_view() --- AK/StringView.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AK/StringView.h b/AK/StringView.h index c8874333ad..7906ccf6f4 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -110,6 +110,8 @@ public: [[nodiscard]] constexpr StringView substring_view(size_t start) const { + if (!is_constant_evaluated()) + VERIFY(start <= length()); return substring_view(start, length() - start); }