From a39ba2cd71190d3e289722cc7bd1199baf7f3af1 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sun, 22 Mar 2020 04:48:50 +0200 Subject: [PATCH] lvgl: Fix edge case in lv_label_set_text This fixes an edge case where the original label set was done with set_static_text, the next one with set_text and the text is at the same address. The incomplete check would think that the text resides on heap and it would reallocate it as such, effectively corrupting .data on the next sets. --- nyx/nyx_gui/libs/lvgl/lv_objx/lv_label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nyx/nyx_gui/libs/lvgl/lv_objx/lv_label.c b/nyx/nyx_gui/libs/lvgl/lv_objx/lv_label.c index 77b087a..57ac2d0 100644 --- a/nyx/nyx_gui/libs/lvgl/lv_objx/lv_label.c +++ b/nyx/nyx_gui/libs/lvgl/lv_objx/lv_label.c @@ -156,7 +156,7 @@ void lv_label_set_text(lv_obj_t * label, const char * text) return; } - if(ext->text == text) { + if(ext->text == text && ext->static_txt == 0) { /*If set its own text then reallocate it (maybe its size changed)*/ ext->text = lv_mem_realloc(ext->text, strlen(ext->text) + 1); lv_mem_assert(ext->text);