From 96fef9f64384b9f76641a28247fb63239ff3d39c Mon Sep 17 00:00:00 2001 From: Rubidium Date: Mon, 5 Jun 2023 17:14:35 +0200 Subject: [PATCH] Codechange: allocate enough memory to layout the strings --- src/gfx_layout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp index 9de917a80e..87b9495409 100644 --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -64,8 +64,8 @@ static inline void GetLayouter(Layouter::LineCacheItem &line, std::string_view s { if (line.buffer != nullptr) free(line.buffer); - typename T::CharType *buff_begin = MallocT(DRAW_STRING_BUFFER); - const typename T::CharType *buffer_last = buff_begin + DRAW_STRING_BUFFER; + typename T::CharType *buff_begin = MallocT(str.size() + 1); + const typename T::CharType *buffer_last = buff_begin + str.size() + 1; typename T::CharType *buff = buff_begin; FontMap &fontMapping = line.runs; Font *f = Layouter::GetFont(state.fontsize, state.cur_colour);