From f64beb437973c4100b50a7c71a47ad178867279c Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Mon, 19 Oct 2026 16:25:07 -0500 Subject: [PATCH] Fix random crash while slicing with the Russian UI (daily tips) (#16664) Fix crash when a daily tip has no body text has_cjk() looped while i < text.size() - 2. For a string shorter than two bytes the size_t subtraction wraps, so on an empty string the loop read past the buffer and up the stack until it hit an unmapped page. The Russian translation of the "Reverse on even" tip had lost the \n after its title, so render_text() passed an empty body to has_cjk() every time that tip was shown during slicing. Restore the line break and bound the loop so a translation like this can't crash the app. --- localization/i18n/ru/OrcaSlicer_ru.po | 4 +++- src/slic3r/GUI/DailyTips.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/localization/i18n/ru/OrcaSlicer_ru.po b/localization/i18n/ru/OrcaSlicer_ru.po index 5c7127dbc6..639d9948fc 100644 --- a/localization/i18n/ru/OrcaSlicer_ru.po +++ b/localization/i18n/ru/OrcaSlicer_ru.po @@ -36839,7 +36839,9 @@ msgstr "" msgid "" "Reverse on even\n" "Did you know that Reverse on even feature can significantly improve the surface quality of your overhangs? However, it can cause wall inconsistencies so use carefully!" -msgstr "Реверс на чётных слояхСовет: настройка Реверс на чётных слоях может существенно улучшить качество нависающих поверхностей. Как и нарушить их однородность, так что используйте с осторожностью." +msgstr "" +"Реверс на чётных слоях\n" +"Совет: настройка Реверс на чётных слоях может существенно улучшить качество нависающих поверхностей. Как и нарушить их однородность, так что используйте с осторожностью." #: resources/data/hints.ini: [hint:Cut Tool] msgid "" diff --git a/src/slic3r/GUI/DailyTips.cpp b/src/slic3r/GUI/DailyTips.cpp index 8bace894e1..dc97117efc 100644 --- a/src/slic3r/GUI/DailyTips.cpp +++ b/src/slic3r/GUI/DailyTips.cpp @@ -161,7 +161,7 @@ void DailyTipsDataRenderer::render_img(const ImVec2& start_pos, const ImVec2& si bool has_cjk(const std::string &text) { - for (size_t i = 0; i < text.size() - 2; ++i) { + for (size_t i = 0; i + 2 < text.size(); ++i) { unsigned char c1 = text[i]; unsigned char c2 = text[i + 1]; unsigned char c3 = text[i + 2];