From 77c251bd1d380fea7601ce18dd053f07b930ea14 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Tue, 26 Aug 2025 14:50:43 +0200 Subject: [PATCH] Fix UB in TaggedString constructor (#3748) --- src/mbgl/text/tagged_string.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mbgl/text/tagged_string.hpp b/src/mbgl/text/tagged_string.hpp index 1c2b7d84a..215f424bc 100644 --- a/src/mbgl/text/tagged_string.hpp +++ b/src/mbgl/text/tagged_string.hpp @@ -72,8 +72,9 @@ struct SectionOptions { struct TaggedString { TaggedString() = default; - TaggedString(std::u16string text_, SectionOptions options) - : styledText(std::move(text_), std::vector(text_.size(), 0)) { + TaggedString(std::u16string text_, SectionOptions options) { + auto size = text_.size(); + styledText = {std::move(text_), std::vector(size, 0)}; sections.push_back(std::move(options)); }