From 76afc0efd56dd0e407ea0b04ec4dfb7e538f144f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Kon=C4=8Dek?= Date: Tue, 5 Nov 2024 15:20:58 +0100 Subject: [PATCH] Fix string out-of-bounds access --- src/base64.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base64.cc b/src/base64.cc index 5102f62..c562fa9 100644 --- a/src/base64.cc +++ b/src/base64.cc @@ -56,7 +56,7 @@ std::u8string ot::encode_base64(ot::byte_string_view src) ot::byte_string ot::decode_base64(std::u8string_view src) { // Remove the padding and rely on the string length instead. - while (src.back() == u8'=') + while (!src.empty() && src.back() == u8'=') src.remove_suffix(1); size_t olen = src.size() / 4 * 3; // Whole blocks;