lv_obj_draw_part_dsc_t::text is a const char * which is
modifiable. My "modifiable" the pointer value may be changed -
not that it points to a modifiable buffer. At present LVGL
seems to only set text to a local variable, so it will be
either NULL, or a dangling pointer. Furthermore lv_snprintf
was using sizeof(dsc->test) to determine the buffer size.
This would always use a size of 4.
This change avoids the unnecessary call to lv_snprintf, since
no formatting is being done, by using static const variables.
I see there is a merge conflict because this has been addressed somewhat in master already. I'm going to close this PR. Might resubmit if still an issue.
lv_obj_draw_part_dsc_t::text
is aconst char *
which is modifiable. My "modifiable" the pointer value may be changed - not that it points to a modifiable buffer. At present LVGL seems to only settext
to a local variable, so it will be either NULL, or a dangling pointer. Furthermorelv_snprintf
was usingsizeof(dsc->test)
to determine the buffer size. This would always use a size of 4.This change avoids the unnecessary call to
lv_snprintf
, since no formatting is being done, by using static const variables.This may fix a memory corruption bug.