Skip to content

Commit 77c251b

Browse files
authored
Fix UB in TaggedString constructor (#3748)
1 parent ec8a7a4 commit 77c251b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/mbgl/text/tagged_string.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ struct SectionOptions {
7272
struct TaggedString {
7373
TaggedString() = default;
7474

75-
TaggedString(std::u16string text_, SectionOptions options)
76-
: styledText(std::move(text_), std::vector<uint8_t>(text_.size(), 0)) {
75+
TaggedString(std::u16string text_, SectionOptions options) {
76+
auto size = text_.size();
77+
styledText = {std::move(text_), std::vector<uint8_t>(size, 0)};
7778
sections.push_back(std::move(options));
7879
}
7980

0 commit comments

Comments
 (0)