1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

Fix #1498: lv_label_set_text() crash (#1499)

This routine tried to optimize a special case of setting the label text to the same address as previously set, but it did not consider whether the prior set was static and tried to realloc non-allocated memory.
This commit is contained in:
Bill Hargen 2020-05-15 13:42:50 -04:00 committed by GitHub
parent ac52b502a2
commit 7ac9388aed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -188,7 +188,7 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
LV_ASSERT_STR(text);
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_ASSERT_MEM(ext->text);