Fixes 2 Bugs and 13 Compiler Warnings (#10670)

* fixes: %g directive writing between 1 and 13 bytes into a region of size between 6 and 18 [-Wformat-overflow=]

* fixes: %5s directive writing between 5 and 63 bytes into a region of size 58 [-Wformat-overflow=]

* fixes: catching polymorphic type by value [-Wcatch-value=]

* fixes: [-Wcomment]; removes whitespaces

* increases buffer size from 71B to 90B to avoid potential ovfl.
This commit is contained in:
Dipl.-Ing. Raoul Rubien, BSc
2026-08-05 21:41:04 +08:00
committed by GitHub
parent a10d9e77cf
commit 23bd320076
12 changed files with 30 additions and 31 deletions
+1 -1
View File
@@ -1733,7 +1733,7 @@ std::string IMSlider::get_label(int tick, LabelType label_type)
::sprintf(layer_height, "%.2f", m_values.empty() ? m_label_koef * value : m_values[value]);
if (label_type == ltHeight) return std::string(layer_height);
if (label_type == ltHeightWithLayer) {
char buffer[64];
char buffer[90];
size_t layer_number;
layer_number = m_draw_mode == dmSequentialFffPrint ? (m_values.empty() ? value : value + 1) : m_is_wipe_tower ? get_layer_number(value, label_type) + 1 : (m_values.empty() ? value : value + 1);
::sprintf(buffer, "%5s\n%5s", std::to_string(layer_number).c_str(), layer_height);