crbench//

← all cases

xml: sync the widget schemas with the runtime parsers

Tier 2 hard c · cross-file · real merged PR from lvgl/lvgl #8689

Ground-truth defects

d1 · correctness · medium
The textarea XML schema is changed to declare the placeholder property as `placeholder_text`, but the textarea XML parser, which the change does not touch, still matches only the attribute name `placeholder`. XML written against the updated schema, such as `<lv_textarea placeholder_text="Type here"/>`, matches no branch in the parser's attribute chain, so `lv_textarea_set_placeholder_text` is never called. The attribute loop has no unknown-attribute warning, so the placeholder is dropped silently.
d2 · correctness · medium
`grid_update` gains an early return when the grid calculation fails, but the calculation has already allocated its row arrays by then and the early return skips the free routine. A grid container that has a row descriptor but no column descriptor, on itself or its parent, gets `c->y` and `c->h` allocated in the row pass and then fails the column pass, leaking both arrays on every layout refresh. Calling the existing free routine at that point is not by itself a safe fix, because the struct is not zeroed on every failure path.
d3 · correctness · medium
The new tabview tab-button create callback reads the optional `index` attribute and passes the result straight to the XML integer parser. A missing attribute makes the lookup return NULL and the parser dereferences it immediately, so any XML using the tab-button element without an explicit index crashes once the tabview already has a tab, instead of falling back to the first tab.

The change under review

diff (truncated — full diff)
diff --git a/docs/src/details/auxiliary-modules/observer/observer.rst b/docs/src/details/auxiliary-modules/observer/observer.rst
index 2289569..86c0a41 100644
--- a/docs/src/details/auxiliary-modules/observer/observer.rst
+++ b/docs/src/details/auxiliary-modules/observer/observer.rst
@@ -361,13 +361,18 @@ integer value:
 
 - flag (or OR-ed combination of flags) from from the ``LV_OBJ_FLAG_...`` enumeration values;
 - state (or OR-ed combination of states) from the ``LV_STATE_...`` enumeration values;
-- text value for Label Widgets;
+- text value for
+
+    - Label
+    - Span;
+
 - integer value for these Widget types:
 
     - Arc
     - Drop-Down
     - Roller
     - Slider
+    - Scale Section Min/Max value
 
 Any number of Observers can be created for a single Widget, each bound to ONE of
 the above properties.
@@ -507,6 +512,15 @@ If ``NULL`` is passed for the ``format_string`` argument:
 **Example:**  "%d |deg|\C"
 
 
+Spangroup's Span
+~~~~~~~~~~~~~~~~
+
+Very similarly to Label Text binding a Span's text can be bound to a subject as well.
+
+The only difference is that in the bind function both the spangroup and the span needs to be specified:
+
+ :cpp:expr:`lv_spangroup_bind_span_text(spangroup, span1, &subject, format_string)`
+
 Arc Widgets
 ~~~~~~~~~~~
 
@@ -559,9 +573,23 @@ It support only integer subjects.
 
 - :cpp:expr:`lv_dropdown_bind_value(dropdown, &subject)`
 
+Scale's Section
+~~~~~~~~~~~~~~~
+
+This method of subscribing to an integer Subject affects a Section of a Scale Widget's integer
+minimum or maximum values directly.  Note that this is a one way binding (Subject ==> Widget)
+as the Scale Section's are not interactive.
+(Requires :c:macro:`LV_USE_SCALE` to be configured to ``1``.)
+
+It support only integer subjects.
+
+- :cpp:expr:`lv_scale_bind_section_min_value(scale, section1, &subject)`
+- :cpp:expr:`lv_scale_bind_section_max_value(scale, section1, &subject)`
+
 
 .. _change_subject_on_event:
 
+
 Change Subject on Event
 -----------------------
 
diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c
index c532989..8b4edf8 100644
--- a/src/core/lv_obj.c
+++ b/src/core/lv_obj.c
@@ -73,7 +73,6 @@ static void null_on_delete_cb(lv_event_t * e);
 static void screen_load_on_trigger_event_cb(lv_event_t * e);
 static void screen_create_on_trigger_event_cb(lv_event_t * e);
 static void play_timeline_on_trigger_event_cb(lv_event_t * e);
-static void free_user_data_on_delete_event_cb(lv_event_t * e);
 static void delete_on_screen_unloaded_event_cb(lv_event_t * e);
 
 #if LV_USE_OBJ_PROPERTY
@@ -508,7 +507,7 @@ void lv_obj_add_screen_load_event(lv_obj_t * obj, lv_event_code_t trigger, lv_ob
     dsc->target.screen = screen;
 
     lv_obj_add_event_cb(obj, screen_load_on_trigger_event_cb, trigger, dsc);
-    lv_obj_add_event_cb(obj, free_user_data_on_delete_event_cb, LV_EVENT_DELETE, dsc);
+    lv_obj_add_event_cb(obj, lv_event_free_user_data_cb, LV_EVENT_DELETE, dsc);
 }
 
 void lv_obj_add_screen_create_event(lv_obj_t * obj, lv_event_code_t trigger, lv_screen_create_cb_t screen_create_cb,
@@ -523,7 +522,7 @@ void lv_obj_add_screen_create_event(lv_obj_t * obj, lv_event_code_t trigger, lv_
     dsc->target.create_cb = screen_create_cb;
 
     lv_obj_add_event_cb(obj, screen_create_on_trigger_event_cb, trigger, dsc);
-    lv_obj_add_event_cb(obj, free_user_data_on_delete_event_cb, LV_EVENT_DELETE, dsc);
+    lv_obj_add_event_cb(obj, lv_event_free_user_data_cb, LV_EVENT_DELETE, dsc);
 }
 
 void lv_obj_add_play_timeline_event(lv_obj_t * obj, lv_event_code_t trigger, lv_anim_timeline_t * at, uint32_t delay,
@@ -537,7 +536,7 @@ void lv_obj_add_play_timeline_event(lv_obj_t * obj, lv_event_code_t trigger, lv_
     dsc->reverse = reverse;
 
     lv_obj_add_event_cb(obj, play_timeline_on_trigger_event_cb, trigger, dsc);
-    lv_obj_add_event_cb(obj, free_user_data_on_delete_event_cb, LV_EVENT_DELETE, dsc);
+    lv_obj_add_event_cb(obj, lv_event_free_user_data_cb, LV_EVENT_DELETE, dsc);
 }
 
 void lv_obj_set_user_data(lv_obj_t * obj, void * user_data)
@@ -1156,10 +1155,6 @@ static void play_timeline_on_trigger_event_cb(lv_event_t * e)
     lv_anim_timeline_start(dsc->at);
 }
 
-static void free_user_data_on_delete_event_cb(lv_event_t * e)
-{
-    lv_free(lv_event_get_user_data(e));
-}
 
 static void delete_on_screen_unloaded_event_cb(lv_event_t * e)
 {
diff --git a/src/core/lv_obj_tree.h b/src/core/lv_obj_tree.h
index e869576..9850b5a 100644
--- a/src/core/lv_obj_tree.h
+++ b/src/core/lv_obj_tree.h
@@ -40,7 +40,7 @@ typedef lv_obj_tree_walk_res_t (*lv_obj_tree_walk_cb_t)(lv_obj_t *, void *);
 /**
  * Delete an object and all of its children.
  * Also remove the objects from their group and remove all animations (if any).
- * Send `LV_EVENT_DELETED` to deleted objects.
+ * Send `LV_EVENT_DELETE` to deleted objects.
  * @param obj       pointer to an object
  */
 void lv_obj_delete(lv_obj_t * obj);
@@ -48,7 +48,7 @@ void lv_obj_delete(lv_obj_t * obj);
 /**
  * Delete all children of an object.
  * Also remove the objects from their group and remove all animations (if any).
- * Send `LV_EVENT_DELETED` to deleted objects.
+ * Send `LV_EVENT_DELETE` to deleted objects.
  * @param obj       pointer to an object
  */
 void lv_obj_clean(lv_obj_t * obj);
diff --git a/src/layouts/grid/lv_grid.c b/src/layouts/grid/lv_grid.c
index 79ffa20..7efd28d 100644
--- a/src/layouts/grid/lv_grid.c
+++ b/src/layouts/grid/lv_grid.c
@@ -189,12 +189,9 @@ static void grid_update(lv_obj_t * cont, void * user_data)
     LV_LOG_INFO("update %p container", (void *)cont);
     LV_UNUSED(user_data);
 
-    //    const int32_t * col_templ = get_col_dsc(cont);
-    //    const int32_t * row_templ = get_row_dsc(cont);
-    //    if(col_templ == NULL || row_templ == NULL) return;
-
     lv_grid_calc_t c;
-    calc(cont, &c);
+    lv_result_t res = calc(cont, &c);
+    if(res != LV_RESULT_OK) return;
 
     item_repos_hint_t hint;
     lv_memzero(&hint, sizeof(hint));
diff --git a/src/misc/lv_event.c b/src/misc/lv_event.c
index 44e4c57..c15e7fb 100644
--- a/src/misc/lv_event.c
+++ b/src/misc/lv_event.c
@@ -239,6 +239,12 @@ void lv_event_stop_processing(lv_event_t * e)
     e->stop_processing = 1;
 }
 
+void lv_event_free_user_data_cb(lv_event_t * e)
+{
+    void * p = lv_event_get_user_data(e);
+    lv_free(p);
+}
+
 uint32_t lv_event_register_id(void)
 {
     event_last_id ++;
diff --git a/src/misc/lv_event.h b/src/misc/lv_event.h
index 4e04664..c8a66f9 100644
--- a/src/misc/lv_event.h
+++ b/src/misc/lv_event.h
@@ -209,6 +209,14 @@ void lv_event_stop_trickling(lv_event_t * e);
  */
 void lv_event_stop_processing(lv_event_t * e);
 
+/**
+ * Helper function typically used in LV_EVENT_DELETE
+ * to free the event's user_data
+ * @param e     pointer to an event descriptor
+ */
+void lv_event_free_user_data_cb(lv_event_t * e);
+
+
 /**
  * Register a new, custom event ID.
  * It can be used the same way as e.g. `LV_EVENT_CLICKED` to send custom events
diff --git a/src/misc/lv_text_private.h b/src/misc/lv_text_private.h
index 1088c85..b553b4b 100644
--- a/src/misc/lv_text_private.h
+++ b/src/misc/lv_text_private.h
@@ -80,7 +80,7 @@ void lv_text_ins(char * txt_buf, uint32_t pos, const char * ins_txt);
 void lv_text_cut(char * txt, uint32_t pos, uint32_t len);
 
 /**
- * return a new formatted text. Memory will be allocated to store the text.
+ * Return a new formatted text. Memory will be allocated to store the text.
  * @param fmt `printf`-like format
  * @param ap items to print
 
diff --git a/src/others/observer/lv_observer.c b/src/others/observer/lv_observer.c
index 9f9d8e7..15cf46e 100644
--- a/src/others/observer/lv_observer.c
+++ b/src/others/observer/lv_observer.c
@@ -55,6 +55,11 @@ typedef struct {
     const char * value;
 } subject_set_string_user_data_t;
 
+typedef struct {
+    lv_subject_t * subject;
+    void * element; /**< E.g. span of a span group*/
+    const char * fmt;
+} bind_element_string_t;
 
 typedef struct {
     lv_subject_t * subject;
@@ -92,6 +97,10 @@ static void lv_subject_notify_if_changed(lv_subject_t * subject);
     static void label_text_observer_cb(lv_observer_t * observer, lv_subject_t * subject);
 #endif
 
+#if LV_USE_SPAN
+    static void span_text_observer_cb(lv_observer_t * observer, lv_subject_t * subject);
+#endif
+
 #if LV_USE_ARC
     static void arc_value_changed_event_cb(lv_event_t * e);
     static void arc_value_observer_cb(lv_observer_t * observer, lv_subject_t * subject);
@@ -112,7 +121,11 @@ static void lv_subject_notify_if_changed(lv_subject_t * subject);
     static void dropdown_value_observer_cb(lv_observer_t * observer, lv_subject_t * subject);
 #endif
 
-static void free_user_data_event_cb(lv_event_t * e);
+#if LV_USE_SCALE
+    static void scale_section_min_value_observer_cb(lv_observer_t * observer, lv_subject_t * subject);
+    static void scale_section_max_value_observer_cb(lv_observer_t * observer, lv_subject_t * subject);
+#endif
+
 static void subject_set_string_free_user_data_event_cb(lv_event_t * e);
 
 /**********************
@@ -565,7 +578,7 @@ void lv_obj_add_subject_increment_event(lv_obj_t * obj, lv_subject_t * subject,
     user_data->max = max;
     user_data->subject = subject;
     lv_obj_add_event_cb(obj, subject_increment_cb, trigger, user_data);
-    lv_obj_add_event_cb(obj, free_user_data_event_cb, LV_EVENT_DELETE, user_data);
+    lv_obj_add_event_cb(obj, lv_event_free_user_data_cb, LV_EVENT_DELETE, user_data);
 }
 
 void lv_obj_add_subject_set_int_event(lv_obj_t * obj, lv_subject_t * subject, lv_event_code_t trigger, int32_t value)
@@ -581,7 +594,7 @@ void lv_obj_add_subject_set_int_event(lv_obj_t * obj, lv_subject_t * subject, lv
     user_data->value = value;
 
     lv_obj_add_event_cb(obj, subject_set_int_cb, trigger, user_data);
-    lv_obj_add_event_cb(obj, free_user_data_event_cb, LV_EVENT_DELETE, user_data);
+    lv_obj_add_event_cb(obj, lv_event_free_user_data_cb, LV_EVENT_DELETE, user_data);
 }
 
 #if LV_USE_FLOAT
@@ -598,7 +611,7 @@ void lv_obj_add_subject_set_float_event(lv_obj_t * obj, lv_subject_t * subject,
     user_data->value = value;
 
     lv_obj_add_event_cb(obj, subject_set_float_cb, trigger, user_data);
-    lv_obj_add_event_cb(obj, free_user_data_event_cb, LV_EVENT_DELETE, user_data);
+    lv_obj_add_event_cb(obj, lv_event_free_user_data_cb, LV_EVENT_DELETE, user_data);
 }
 #endif /*LV_USE_FLOAT*/
 
@@ -779,6 +792,54 @@ lv_observer_t * lv_label_bind_text(lv_obj_t * obj, lv_subject_t * subject, const
 }
 #endif /*LV_USE_LABEL*/
 
+#if LV_USE_SPAN
+lv_observer_t * lv_spangroup_bind_span_text(lv_obj_t * obj, lv_span_t * span, lv_subject_t * subject, const char * fmt)
+{
+    LV_ASSERT_NULL(subject);
+    LV_ASSERT_NULL(obj);
+    LV_ASSERT_NULL(span);
+
+    if(fmt == NULL) {
+        if(subject->type == LV_SUBJECT_TYPE_INT) {
+            fmt = "%d";
+        }
+#if LV_USE_FLOAT
+        else if(subject->type == LV_SUBJECT_TYPE_FLOAT) {
+            fmt = "%0.1f";
+        }
+#endif
+        else if(subject->type != LV_SUBJECT_TYPE_STRING && subject->type != LV_SUBJECT_TYPE_POINTER) {
+            LV_LOG_WARN("Incompatible subject type: %d", subject->type);
+            return NULL;
+        }
+    }
+    else {
+        if(subject->type != LV_SUBJECT_TYPE_STRING && subject->type != LV_SUBJECT_TYPE_POINTER &&
+           subject->type != LV_SUBJECT_TYPE_INT && subject->type != LV_SUBJECT_TYPE_FLOAT) {
+            LV_LOG_WARN("Incompatible subject type: %d", subject->type);
+            return NULL;
+        }
+    }
+
+    bind_element_string_t * user_data = lv_zalloc(sizeof(bind_element_string_t));
+    if(user_data == NULL) {
+        LV_LOG_WARN("Couldn't allocate user_data");
+        LV_ASSERT_MALLOC(user_data);
+        return NULL;
+    }
+
+    user_data->subject = subject;
+    user_data->element = span;
+    user_data->fmt = fmt;
+
+    lv_observer_t * observer = lv_subject_add_observer_obj(subject, span_text_observer_cb, obj, user_data);
+    observer->auto_free_user_data = 1;
+
+    return observer;
+}
+#endif /*LV_USE_SPAN*/
+
+
 #if LV_USE_ARC
 lv_observer_t * lv_arc_bind_value(lv_obj_t * obj, lv_subject_t * subject)
 {
@@ -851,6 +912,40 @@ lv_observer_t * lv_dropdown_bind_value(lv_obj_t * obj, lv_subject_t * subject)
 }
 #endif /*LV_USE_DROPDOWN*/
 
+#if LV_USE_SCALE
+
+lv_observer_t * lv_scale_bind_section_min_value(lv_obj_t * obj, lv_scale_section_t * section, lv_subject_t * subject)
+{
+    LV_ASSERT_NULL(subject);
+    LV_ASSERT_NULL(obj);
+
+    if(subject->type != LV_SUBJECT_TYPE_INT) {
+        LV_LOG_WARN("Incompatible subject type: %d", subject->type);
+        return NULL;
+    }
+
+    lv_observer_t * observer = lv_subject_add_observer_obj(subject, scale_section_min_value_observer_cb, obj, section);
+
+    return observer;
+}
+
+lv_observer_t * lv_scale_bind_section_max_value(lv_obj_t * obj, lv_scale_section_t * section, lv_subject_t * subject)
+{
+    LV_ASSERT_NULL(subject);
+    LV_ASSERT_NULL(obj);
+
+    if(subject->type != LV_SUBJECT_TYPE_INT) {
+        LV_LOG_WARN("Incompatible subject type: %d", subject->type);
+        return NULL;
+    }
+
+    lv_observer_t * observer = lv_subject_add_observer_obj(subject, scale_section_max_value_observer_cb, obj, section);
+
+    return observer;
+}
+
+#endif /*LV_USE_SCALE*/
+
 lv_obj_t * lv_observer_get_target_obj(lv_observer_t * observer)
 {
     return (lv_obj_t *)lv_observer_get_target(observer);
@@ -1090,6 +1185,39 @@ static void label_text_observer_cb(lv_observer_t * observer, lv_subject_t * subj
 
 #endif /*LV_USE_LABEL*/
 
+#if LV_USE_SPAN
+
+static void span_text_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
+{
+    bind_element_string_t * user_data = observer->user_data;
+
+    if(user_data->fmt == NULL) {
+        lv_spangroup_set_span_text(observer->target, user_data->element, subject->value.pointer);
+    }
+    else {
+        switch(subject->type) {
+
+            case LV_SUBJECT_TYPE_INT:
+                lv_spangroup_set_span_text_fmt(observer->target, user_data->element, user_data->fmt, subject->value.num);
+                break;
+#if LV_USE_FLOAT
+            case LV_SUBJECT_TYPE_FLOAT:
+                lv_spangroup_set_span_text_fmt(observer->target, user_data->element, user_data->fmt, subject->value.float_v);
+                break;
+#endif
+            case LV_SUBJECT_TYPE_STRING:
+            case LV_SUBJECT_TYPE_POINTER:
+                lv_spangroup_set_span_text_fmt(observer->target, user_data->element, user_data->fmt, subject->value.pointer);
+                break;
+            default:
+                return;
+        }
+    }
+}
+
+#endif /*LV_USE_SPAN*/
+
+
 #if LV_USE_ARC
 
 static void arc_value_changed_event_cb(lv_event_t * e)
@@ -1188,11 +1316,22 @@ static void dropdown_value_observer_cb(lv_observer_t * observer, lv_subject_t *
 
 #endif /*LV_USE_DROPDOWN*/
 
-static void free_user_data_event_cb(lv_event_t * e)
+#if LV_USE_SCALE
+
+static void scale_section_min_value_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
+{
+    lv_scale_section_t * section = observer->user_data;
+    lv_scale_set_section_min_value(observer->target, section, subject->value.num);
+}
+
+static void scale_section_max_value_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
 {
-    lv_free(lv_event_get_user_data(e));
+    lv_scale_section_t * section = observer->user_data;
+    lv_scale_set_section_max_value(observer->target, section, subject->value.num);
 }
 
+#endif /*LV_USE_SCALE*/
+
 static void subject_set_string_free_user_data_event_cb(lv_event_t * e)
 {
     subject_set_string_user_data_t * user_data = lv_event_get_user_data(e);
diff --git a/src/others/observer/lv_observer.h b/src/others/observer/lv_observer.h
index 1ce17c4..742a1f8 100644
--- a/src/others/observer/lv_observer.h
+++ b/src/others/observer/lv_observer.h
@@ -545,6 +545,24 @@ lv_observer_t * lv_obj_bind_checked(lv_obj_t * obj, lv_subject_t * subject);
 lv_observer_t * lv_label_bind_text(lv_obj_t * obj, lv_subject_t * subject, const char * fmt);
 #endif
 
+#if LV_USE_LABEL
+
+/**
+ * Bind an integer, string, or pointer Subject to a Label.
+ * @param obj       pointer to Spangroup
+ * @param span      pointer to Span
+ * @param subject   pointer to Subject
+ * @param fmt       optional printf-like format string with 1 format specifier (e.g. "%d °C")
+ *                  or NULL to bind to the value directly.
+ * @return          pointer to newly-created Observer
+ * @note            `fmt == NULL` can be used only with string and pointer Subjects.
+ * @note            If Subject is a pointer and `fmt == NULL`, pointer must point
+ *                  to a `\0` terminated string.
+ */
+lv_observer_t * lv_spangroup_bind_span_text(lv_obj_t * obj, lv_span_t * span, lv_subject_t * subject, const char * fmt);
+
+#endif
+
 #if LV_USE_ARC
 /**
  * Bind an integer subject to an Arc's value.
@@ -585,6 +603,28 @@ lv_observer_t * lv_roller_bind_value(lv_obj_t * obj, lv_subject_t * subject);
 lv_observer_t * lv_dropdown_bind_value(lv_obj_t * obj, lv_subject_t * subject);
 #endif
 
+#if LV_USE_SCALE
+
+/**
+ * Bind an integer subject to a scales section minimum value
+ * @param obj       pointer to an Scale
+ * @param section   pointer to a Scale section
+ * @param subject   pointer to a Subject
+ * @return          pointer to newly-created Observer
+ */
+lv_observer_t * lv_scale_bind_section_min_value(lv_obj_t * obj, lv_scale_section_t * section, lv_subject_t * subject);
+
+/**
+ * Bind an integer subject to a scales section maximum value
+ * @param obj       pointer to an Scale
+ * @param section   pointer to a Scale section
+ * @param subject   pointer to a Subject
+ * @return          pointer to newly-created Observer
+ */
+lv_observer_t * lv_scale_bind_section_max_value(lv_obj_t * obj, lv_scale_section_t * section, lv_subject_t * subject);
+
+#endif
+
 /**********************
  *      MACROS
  **********************/
diff --git a/src/others/xml/lv_xml.c b/src/others/xml/lv_xml.c
index 019893d..40773a9 100644
--- a/src/others/xml/lv_xml.c
+++ b/src/others/xml/lv_xml.c
@@ -37,6 +37,7 @@
 #include "parsers/lv_xml_textarea_parser.h"
 #include "parsers/lv_xml_keyboard_parser.h"
 #include "parsers/lv_xml_arc_parser.h"
+#include "parsers/lv_xml_switch_parser.h"
 #include "parsers/lv_xml_checkbox_parser.h"

Leaderboard for this case

hard · 2 of 9 bots fully caught it (22% solve rate) · 52% avg coverage.

#BotResultCaughtCoverageFindingsFalse alarms
1 Drape (Deep Review) solved 3/3 100.0% 16 0
2 Drape (Review) solved 3/3 100.0% 9 0
3 Cubic partial 2/3 66.7% 15 0
4 cursor partial 2/3 66.7% 7 0
5 Claude Code (Opus 5.5) partial 1/3 33.3% 8 0
6 Mjolnir (Opus 5.5) partial 1/3 33.3% 7 0
7 Mjolnir (Sonnet 5.5) partial 1/3 33.3% 7 0
8 qodo partial 1/3 33.3% 14 0
9 greptile miss 0/3 0.0% 6 0

Bot results

Claude Code (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 medium ✗ —
d2 medium ✓ exact
d3 medium ✗ —
valid · impact medium
The condition can only be true when txt is NULL, so the old heap text is never freed before span->txt is overwritten. That leaks memory on every call. The observer actually calls the spangroup variant, but this function has the same leak. [grounded: diff] [consensus 3/3: valid=3]
valid · impact high
lv_spangroup_set_span_text_fmt has the same inverted check. span_text_observer_cb calls it on every subject change when a format string is set, so it leaks the old text each time. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The function returns before va_end when the allocation fails, so va_start has no matching va_end. That is undefined behavior, but it only happens on an out-of-memory path. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The prototype is guarded by LV_USE_LABEL while the definition and its callers use LV_USE_SPAN. With LV_USE_SPAN=1 and LV_USE_LABEL=0, the XML spangroup parser calls a function that has no declaration. [grounded: tree src/others/observer/lv_observer.h] [consensus 3/3: valid=3]
valid · matches d2 · impact medium
valid · impact low
The new grid dsc parsing writes into the result of lv_malloc without a NULL check, and it casts away const to split the attribute value in place. The claim that later reads see corrupted attributes is speculative, but the unchecked allocation is real. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The observer's lifetime is tied to the spangroup object, not the span. lv_spangroup_delete_span frees the span without removing the observer, so the next notification writes through a freed pointer. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The bind functions pass section through without validating it. The setter has LV_ASSERT_NULL, so a NULL section still crashes or halts on the first notification. This is a minor robustness issue. [grounded: diff] [consensus 3/5: valid=3, invalid=2]
raw comments (8)
src/widgets/span/lv_span.c:216
The old-text free check is inverted in `lv_span_set_text_fmt` (and again in `lv_spangroup_set_span_text_fmt`): `if(span->txt == NULL && span->static_flag) lv_free(span->txt);` can only ever free NULL. It should be `span->txt != NULL && !span->static_flag`. As written, the old heap text is leaked every time a span's text is set. The new `lv_spangroup_bind_span_text` observer calls this on every subject change, so the leak repeats with each update and memory runs out on long-running devices.
src/widgets/span/lv_span.c:270
This is the same inverted condition in `lv_spangroup_set_span_text_fmt`: `span->txt == NULL && span->static_flag` never frees the previous dynamically allocated text, so every call leaks it. This function is the one `span_text_observer_cb` uses for INT, FLOAT, STRING and POINTER subjects whenever a format string is given.
src/widgets/span/lv_span.c:211
`va_end(args)` is skipped when `lv_text_set_text_vfmt` returns NULL, because of the early `return` before `va_end`. Calling `va_start` without a matching `va_end` is undefined behavior. The same pattern appears in `lv_spangroup_set_span_text_fmt`.
src/others/observer/lv_observer.h:548
The prototype for `lv_spangroup_bind_span_text` is guarded by `#if LV_USE_LABEL`, but the definition is guarded by `LV_USE_SPAN`. With `LV_USE_LABEL=1` and `LV_USE_SPAN=0`, the header references `lv_span_t`, which may not be defined, so the build can fail. With `LV_USE_SPAN=1` and `LV_USE_LABEL=0`, the prototype is missing, which gives an implicit-declaration error in the XML spangroup parser. The doc comment also says 'Label' where it means Span.
src/layouts/grid/lv_grid.c:194
`grid_update` now returns early whenever `calc()` is not OK. `calc()` returns `LV_RESULT_INVALID` for a container with no children. Before this change an empty grid still ran `lv_obj_refr_size` (for LV_SIZE_CONTENT) and sent `LV_EVENT_LAYOUT_CHANGED`. Now it skips both, so a content-sized grid whose last child is removed keeps its old size and listeners never get the layout-changed event. Also, if `calc_rows` succeeds (allocating `c->y`/`c->h`) and `calc_cols` then fails, the early return skips `calc_free` and leaks the row arrays.
src/others/xml/parsers/lv_xml_obj_parser.c:905
The grid dsc parsing casts away `const` on the XML attribute value and passes it to `lv_xml_split_str`, which writes '\0' into the buffer in place. This permanently changes the attribute string. Any later code that reads the same attrs (for example, re-applying or re-instantiating a component from stored attributes) will only see the first token. The `lv_malloc` result is also used without a NULL check. The same issues exist in `lv_xml_style.c`, where the allocated array is never freed.
src/others/observer/lv_observer.c:830
The span observer is tied to the spangroup object but keeps a raw `lv_span_t *` in its user_data. If that span is deleted with `lv_spangroup_delete_span` while the spangroup is still alive, the observer is not removed. The next subject notification then writes through a freed span pointer (use-after-free). The scale section bindings have the same weakness for sections, though sections usually live as long as the scale.
src/others/observer/lv_observer.c:918
`lv_scale_bind_section_min_value` and `lv_scale_bind_section_max_value` don't validate `section`, which is unlike the span binding that asserts its element. A NULL section, such as one coming from a failed XML section creation, is dereferenced inside `lv_scale_set_section_min_value`/`max_value` on the first notification.
Cubic · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 medium ✓ off by one
d2 medium ✗ —
d3 medium ✓ exact
valid · impact low
lv_xml_split_str writes '\0' at each delimiter, and in lv_xml_style_register `value` can point to a constant's stored string (value = c->value), so the constant gets truncated. Caveat: the branch matches the "style_"-prefixed names, while globals.xml declares the prop without that prefix, so this only triggers when that exact attribute name is used. [grounded: diff] [consensus 5/5: valid=5]
valid · matches d1 · impact medium
valid · impact medium
The header declares lv_spangroup_bind_span_text under LV_USE_LABEL, but the .c file defines it under LV_USE_SPAN. If the two config flags differ, the declaration and definition don't match (and lv_span_t may be undefined). [grounded: tree src/others/observer/lv_observer.h] [consensus 5/5: valid=5]
valid · impact high
item_cnt counts spaces, so N spaces give N+1 tokens plus the terminator, which is N+2 entries. Only N+1 are allocated, so the terminator write overflows the heap buffer. [grounded: diff] [consensus 5/5: valid=5]
valid · impact low
The style path mallocs the array and never frees it. Component unregister only calls lv_style_reset, and unlike the obj parser there is no delete callback. [grounded: tree src/others/xml/lv_xml_style.c] [consensus 5/5: valid=5]
valid · matches d3 · impact medium
minor
A missing compile-time format attribute is a diagnostics improvement, not a runtime misbehavior. [grounded: tree src/widgets/span/lv_span.h] [consensus 5/5: minor=5]
minor
Same as finding 6: a missing format attribute is a diagnostics nicety, not a runtime defect. [grounded: tree src/widgets/span/lv_span.h] [consensus 5/5: minor=5]
valid · impact low
lv_subject_add_observer_obj returns NULL when allocation fails, and the new code dereferences the result without checking it. [grounded: diff] [consensus 5/5: valid=5]
valid · impact low
The early return happens after va_start and before va_end, which is undefined behavior per the C standard. [grounded: tree src/widgets/span/lv_span.c] [consensus 5/5: valid=5]
valid · impact medium
The condition only frees when txt is NULL, so previously allocated dynamic text is never freed before being overwritten. Every observer update leaks memory. [grounded: tree src/widgets/span/lv_span.c] [consensus 5/5: valid=5]
valid · impact low
lv_text_set_text_vfmt runs Arabic/Persian processing when it is enabled, so the new note saying lv_label_set_text_fmt ignores it is wrong. [grounded: tree src/misc/lv_text.c] [consensus 5/5: valid=5]
minor
A doc summary wording error with no effect on behavior. [grounded: tree src/others/observer/lv_observer.h] [consensus 4/5: minor=4, valid=1]
minor
Grammar nit in the docs. [grounded: tree docs/src/details/auxiliary-modules/observer/observer.rst] [consensus 5/5: minor=5]
minor
Grammar nit in the docs. [grounded: tree docs/src/details/auxiliary-modules/observer/observer.rst] [consensus 5/5: minor=5]
raw comments (16)
src/others/xml/lv_xml_style.c:295
<!-- cubic:v=272462d5-3505-4195-b941-c943a3e25404 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P1: When a grid descriptor uses a `#constant`, this splitter modifies the constant's stored string in place and truncates it at the first space. Copy the value before tokenizing, then release the temporary copy after parsing. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/others/xml/lv_xml_style.c, line 295: <comment>When a grid descriptor uses a `#constant`, this splitter modifies the constant's stored string in place and truncates it at the first space. Copy the value before tokenizing, then release the temporary copy after parsing.</comment> <file context> @@ -280,7 +281,40 @@ lv_result_t lv_xml_style_register(lv_xml_component_scope_t * scope, const char * + + int32_t * dsc_array = lv_malloc((item_cnt + 1) * sizeof(int32_t)); /*+1 for LV_GRID_TEMPLATE_LAST*/ + + char * value_buf = (char *)value; + item_cnt = 0; + const char * sub_value = lv_xml_split_str(&value_buf, ' '); </file context> ``` </details>
xmls/lv_textarea.xml:9
<!-- cubic:v=c74872b5-f2e1-476d-ad54-9faae34bbb25 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P1: When the UI Editor emits `<lv_textarea placeholder_text="..."/>`, the runtime parser ignores the attribute because `lv_xml_textarea_apply` only handles `placeholder`, so the placeholder text is lost. Update the textarea parser to accept `placeholder_text` (while retaining `placeholder` for compatibility), or keep this metadata name aligned with the parser. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At xmls/lv_textarea.xml, line 9: <comment>When the UI Editor emits `<lv_textarea placeholder_text="..."/>`, the runtime parser ignores the attribute because `lv_xml_textarea_apply` only handles `placeholder`, so the placeholder text is lost. Update the textarea parser to accept `placeholder_text` (while retaining `placeholder` for compatibility), or keep this metadata name aligned with the parser.</comment> <file context> @@ -6,7 +6,7 @@ Example <api> <prop name="text" type="string" help=""/> - <prop name="placeholder" type="string" help=""/> + <prop name="placeholder_text" type="string" help=""/> <prop name="one_line" type="bool" help=""/> <prop name="password_mode" type="bool" help=""/> </file context> ``` </details>
src/others/observer/lv_observer.h:548
<!-- cubic:v=3100664c-105c-4618-a394-37f1c88e0075 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P1: When `LV_USE_LABEL` and `LV_USE_SPAN` differ, this declaration does not match the implementation: labels-only builds expose an undefined function, while spans-only builds hide the valid API. Guard this block with `LV_USE_SPAN`. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/others/observer/lv_observer.h, line 548: <comment>When `LV_USE_LABEL` and `LV_USE_SPAN` differ, this declaration does not match the implementation: labels-only builds expose an undefined function, while spans-only builds hide the valid API. Guard this block with `LV_USE_SPAN`.</comment> <file context> @@ -545,6 +545,24 @@ lv_observer_t * lv_obj_bind_checked(lv_obj_t * obj, lv_subject_t * subject); lv_observer_t * lv_label_bind_text(lv_obj_t * obj, lv_subject_t * subject, const char * fmt); #endif +#if LV_USE_LABEL + +/** </file context> ``` </details> ```suggestion #if LV_USE_SPAN ```
src/others/xml/parsers/lv_xml_obj_parser.c:903
<!-- cubic:v=7593064a-2f8e-4137-8c1c-99fbf88a4ea2 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P1: Every grid descriptor value writes the terminator past the allocated array. `item_cnt` is the number of spaces, but the split loop produces `item_cnt + 1` descriptors and then appends `LV_GRID_TEMPLATE_LAST`; allocate `item_cnt + 2` elements. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/others/xml/parsers/lv_xml_obj_parser.c, line 903: <comment>Every grid descriptor value writes the terminator past the allocated array. `item_cnt` is the number of spaces, but the split loop produces `item_cnt + 1` descriptors and then appends `LV_GRID_TEMPLATE_LAST`; allocate `item_cnt + 2` elements.</comment> <file context> @@ -892,14 +891,46 @@ static void apply_styles(lv_xml_parser_state_t * state, lv_obj_t * obj, const ch -static void free_user_data_event_cb(lv_event_t * e) -{ - lv_free(lv_event_get_user_data(e)); + int32_t * dsc_array = lv_malloc((item_cnt + 1) * sizeof(int32_t)); /*+1 for LV_GRID_TEMPLATE_LAST*/ + + char * value_buf = (char *)value; </file context> ``` </details> ```suggestion int32_t * dsc_array = lv_malloc((item_cnt + 2) * sizeof(int32_t)); /*+2 for the first item and LV_GRID_TEMPLATE_LAST*/ ```
src/others/xml/lv_xml_style.c:293
<!-- cubic:v=e953b77d-f53a-40da-b7d1-940a6c0ea1b4 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P2: Each XML style grid-array registration leaks its allocated descriptor array because the style setter does not take ownership and scope teardown never frees it. Track and free these arrays when replacing the property and when unregistering the component, matching the object parser's lifetime cleanup. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/others/xml/lv_xml_style.c, line 293: <comment>Each XML style grid-array registration leaks its allocated descriptor array because the style setter does not take ownership and scope teardown never frees it. Track and free these arrays when replacing the property and when unregistering the component, matching the object parser's lifetime cleanup.</comment> <file context> @@ -280,7 +281,40 @@ lv_result_t lv_xml_style_register(lv_xml_component_scope_t * scope, const char * + if(value[c] == ' ') item_cnt++; + } + + int32_t * dsc_array = lv_malloc((item_cnt + 1) * sizeof(int32_t)); /*+1 for LV_GRID_TEMPLATE_LAST*/ + + char * value_buf = (char *)value; </file context> ``` </details>
src/others/xml/parsers/lv_xml_tabview_parser.c:100
<!-- cubic:v=08d64069-5010-489d-99a0-a563ef385729 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P2: When `lv_tabview-tab_button` omits `index`, `index_str` is `NULL` and `lv_xml_atoi(index_str)` dereferences it, aborting XML parsing. Default the index or reject the element before calling `lv_xml_atoi`. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/others/xml/parsers/lv_xml_tabview_parser.c, line 100: <comment>When `lv_tabview-tab_button` omits `index`, `index_str` is `NULL` and `lv_xml_atoi(index_str)` dereferences it, aborting XML parsing. Default the index or reject the element before calling `lv_xml_atoi`.</comment> <file context> @@ -87,6 +87,33 @@ void lv_xml_tabview_tab_apply(lv_xml_parser_state_t * state, const char ** attrs + } + + const char * index_str = lv_xml_get_value_of(attrs, "index"); + int32_t index_int = lv_xml_atoi(index_str); + if(LV_ABS(index_int) >= btn_cnt) { + LV_LOG_WARN("tabindex is out of range, using the first tab instead"); </file context> ``` </details> ```suggestion int32_t index_int = index_str ? lv_xml_atoi(index_str) : 0; ```
src/widgets/span/lv_span.h:139
<!-- cubic:v=d566d7b8-566b-4c1a-a31b-e89eab4c6324 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":9} --> P2: Calls to `lv_spangroup_set_span_text_fmt` are not compiler-checked for format and argument mismatches because this declaration omits `LV_FORMAT_ATTRIBUTE`. Add the attribute so invalid calls are diagnosed before the variadic formatter processes them. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/widgets/span/lv_span.h, line 139: <comment>Calls to `lv_spangroup_set_span_text_fmt` are not compiler-checked for format and argument mismatches because this declaration omits `LV_FORMAT_ATTRIBUTE`. Add the attribute so invalid calls are diagnosed before the variadic formatter processes them.</comment> <file context> @@ -118,6 +129,15 @@ void lv_spangroup_set_span_text(lv_obj_t * obj, lv_span_t * span, const char * t + * @param span pointer to a span. + * @param fmt `printf`-like format string + */ +void lv_spangroup_set_span_text_fmt(lv_obj_t * obj, lv_span_t * span, const char * fmt, ...); + /** </file context> ``` </details> ```suggestion void lv_spangroup_set_span_text_fmt(lv_obj_t * obj, lv_span_t * span, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(3, 4); ```
src/widgets/span/lv_span.h:103
<!-- cubic:v=538d96de-bb83-4db8-832c-369604ded2e3 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":9} --> P2: Calls to `lv_span_set_text_fmt` are not compiler-checked for format and argument mismatches because this declaration omits `LV_FORMAT_ATTRIBUTE`. Add the format attribute so invalid calls are diagnosed before the variadic formatter processes them. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/widgets/span/lv_span.h, line 103: <comment>Calls to `lv_span_set_text_fmt` are not compiler-checked for format and argument mismatches because this declaration omits `LV_FORMAT_ATTRIBUTE`. Add the format attribute so invalid calls are diagnosed before the variadic formatter processes them.</comment> <file context> @@ -91,6 +91,17 @@ void lv_spangroup_delete_span(lv_obj_t * obj, lv_span_t * span); + * @param span pointer to a span. + * @param fmt `printf`-like format string + */ +void lv_span_set_text_fmt(lv_span_t * span, const char * fmt, ...); + /** </file context> ``` </details> ```suggestion void lv_span_set_text_fmt(lv_span_t * span, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); ```
src/others/observer/lv_observer.c:836
<!-- cubic:v=34e03087-2984-48d0-aea9-557b14948c40 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":9} --> P2: When observer allocation fails, `lv_subject_add_observer_obj` returns `NULL`, but this function immediately dereferences it and leaks `user_data`. Check `observer` before setting `auto_free_user_data`, free `user_data`, and return `NULL`. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/others/observer/lv_observer.c, line 836: <comment>When observer allocation fails, `lv_subject_add_observer_obj` returns `NULL`, but this function immediately dereferences it and leaks `user_data`. Check `observer` before setting `auto_free_user_data`, free `user_data`, and return `NULL`.</comment> <file context> @@ -779,6 +792,54 @@ lv_observer_t * lv_label_bind_text(lv_obj_t * obj, lv_subject_t * subject, const + user_data->fmt = fmt; + + lv_observer_t * observer = lv_subject_add_observer_obj(subject, span_text_observer_cb, obj, user_data); + observer->auto_free_user_data = 1; + + return observer; </file context> ``` </details> ```suggestion if(observer == NULL) { lv_free(user_data); return NULL; } observer->auto_free_user_data = 1; ```
src/widgets/span/lv_span.c:212
<!-- cubic:v=27f98378-f801-48a3-a029-df5b13979f85 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":9} --> P2: When this wrapper cannot allocate the formatted string, it returns without ending the variadic argument list. Call `va_end(args)` before returning on the failure path. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/widgets/span/lv_span.c, line 212: <comment>When this wrapper cannot allocate the formatted string, it returns without ending the variadic argument list. Call `va_end(args)` before returning on the failure path.</comment> <file context> @@ -199,6 +199,29 @@ void lv_span_set_text(lv_span_t * span, const char * text) + va_start(args, fmt); + char * text = lv_text_set_text_vfmt(fmt, args); + LV_ASSERT_MALLOC(text); + if(text == NULL) return; + + va_end(args); </file context> ``` </details> ```suggestion if(text == NULL) { va_end(args); return; } ```
src/widgets/span/lv_span.c:216
<!-- cubic:v=403a0300-1c5b-4dfa-a357-442d79a03ccd --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P2: When this wrapper formats a span more than once, it leaks the previous dynamically allocated text because the ownership check is inverted. Test `span->txt && span->static_flag == 0` before freeing the old text. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/widgets/span/lv_span.c, line 216: <comment>When this wrapper formats a span more than once, it leaks the previous dynamically allocated text because the ownership check is inverted. Test `span->txt && span->static_flag == 0` before freeing the old text.</comment> <file context> @@ -199,6 +199,29 @@ void lv_span_set_text(lv_span_t * span, const char * text) + + va_end(args); + + if(span->txt == NULL && span->static_flag) { + lv_free(span->txt); + } </file context> ``` </details> ```suggestion if(span->txt && span->static_flag == 0) { ```
src/widgets/label/lv_label.h:100
<!-- cubic:v=f35bd1f7-837c-4b45-a738-7694dd039237 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":9} --> P3: The new @note on lv_label_set_text_fmt is inaccurate. When LV_USE_ARABIC_PERSIAN_CHARS is enabled, lv_label_set_text_fmt formats via lv_text_set_text_vfmt, which runs lv_text_ap_proc on the result (lv_text.c:493-510), so the text IS Arabic/Persian processed. Change the note to state the text is modified, matching the lv_label_set_text note. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/widgets/label/lv_label.h, line 100: <comment>The new @note on lv_label_set_text_fmt is inaccurate. When LV_USE_ARABIC_PERSIAN_CHARS is enabled, lv_label_set_text_fmt formats via lv_text_set_text_vfmt, which runs lv_text_ap_proc on the result (lv_text.c:493-510), so the text IS Arabic/Persian processed. Change the note to state the text is modified, matching the lv_label_set_text note.</comment> <file context> @@ -84,26 +84,28 @@ lv_obj_t * lv_label_create(lv_obj_t * parent); * @code * lv_label_set_text_fmt(label1, "%d user", user_num); * @endcode + * @note It ignores `LV_USE_ARABIC_PERSIAN_CHARS` */ void lv_label_set_text_fmt(lv_obj_t * obj, const char * fmt, ...) LV_FORMAT_ATTRIBUTE(2, 3); </file context> ``` </details> ```suggestion * @note If `LV_USE_ARABIC_PERSIAN_CHARS` is enabled the text will be modified to have the correct Arabic * characters in it. ```
src/others/observer/lv_observer.h:551
<!-- cubic:v=5d35b8ea-0cd4-4999-8a88-b840898e7faf --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P3: The new Spangroup observer is documented as binding to a Label, although its `obj` and `span` parameters target a Spangroup span. Rename the summary so generated API documentation does not mislead users. <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At src/others/observer/lv_observer.h, line 551: <comment>The new Spangroup observer is documented as binding to a Label, although its `obj` and `span` parameters target a Spangroup span. Rename the summary so generated API documentation does not mislead users.</comment> <file context> @@ -545,6 +545,24 @@ lv_observer_t * lv_obj_bind_checked(lv_obj_t * obj, lv_subject_t * subject); +#if LV_USE_LABEL + +/** + * Bind an integer, string, or pointer Subject to a Label. + * @param obj pointer to Spangroup + * @param span pointer to Span </file context> ``` </details> ```suggestion * Bind an integer, string, or pointer Subject to a Span in a Spangroup. ```
docs/src/details/auxiliary-modules/observer/observer.rst:581
<!-- cubic:v=82e621bf-2f5f-4cf2-baca-480d599204a4 --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P3: "the Scale Section's are not interactive" misuses an apostrophe: it should be the plural "Sections" (with "one-way" hyphenated: "one-way binding"). <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At docs/src/details/auxiliary-modules/observer/observer.rst, line 581: <comment>"the Scale Section's are not interactive" misuses an apostrophe: it should be the plural "Sections" (with "one-way" hyphenated: "one-way binding").</comment> <file context> @@ -559,9 +573,23 @@ It support only integer subjects. + +This method of subscribing to an integer Subject affects a Section of a Scale Widget's integer +minimum or maximum values directly. Note that this is a one way binding (Subject ==> Widget) +as the Scale Section's are not interactive. +(Requires :c:macro:`LV_USE_SCALE` to be configured to ``1``.) + </file context> ``` </details> ```suggestion as the Scale Sections are not interactive. ```
docs/src/details/auxiliary-modules/observer/observer.rst:520
<!-- cubic:v=efb4dfa8-5199-4377-809f-be40ee23e20e --> <!-- cubic:review-run=90449e3b-97da-577f-b121-3c55fd7f44b8 --> <!-- metadata:{"confidence":10} --> P3: "both the spangroup and the span needs to be specified" is a subject-verb agreement error: the compound subject requires "need". <details> <summary>Prompt for AI agents</summary> ```text Check if this issue is valid — if so, understand the root cause and fix it. At docs/src/details/auxiliary-modules/observer/observer.rst, line 520: <comment>"both the spangroup and the span needs to be specified" is a subject-verb agreement error: the compound subject requires "need".</comment> <file context> @@ -507,6 +512,15 @@ If ``NULL`` is passed for the ``format_string`` argument: + +Very similarly to Label Text binding a Span's text can be bound to a subject as well. + +The only difference is that in the bind function both the spangroup and the span needs to be specified: + + :cpp:expr:`lv_spangroup_bind_span_text(spangroup, span1, &subject, format_string)` </file context> ``` </details> ```suggestion The only difference is that in the bind function both the spangroup and the span need to be specified: ```
PR-level
<!-- cubic:review-summary:start --> **15 issues found** across 34 files <!-- cubic:review-summary:end --> <details> <summary>Prompt for AI agents (unresolved issues)</summary> ```text Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately. <file name="src/others/xml/lv_xml_style.c"> <violation number="1" location="src/others/xml/lv_xml_style.c:293"> P2: Each XML style grid-array registration leaks its allocated descriptor array because the style setter does not take ownership and scope teardown never frees it. Track and free these arrays when replacing the property and when unregistering the component, matching the object parser's lifetime cleanup.</violation> <violation number="2" location="src/others/xml/lv_xml_style.c:295"> P1: When a grid descriptor uses a `#constant`, this splitter modifies the constant's stored string in place and truncates it at the first space. Copy the value before tokenizing, then release the temporary copy after parsing.</violation> </file> <file name="src/others/xml/parsers/lv_xml_tabview_parser.c"> <violation number="1" location="src/others/xml/parsers/lv_xml_tabview_parser.c:100"> P2: When `lv_tabview-tab_button` omits `index`, `index_str` is `NULL` and `lv_xml_atoi(index_str)` dereferences it, aborting XML parsing. Default the index or reject the element before calling `lv_xml_atoi`.</violation> </file> <file name="src/widgets/label/lv_label.h"> <violation number="1" location="src/widgets/label/lv_label.h:100"> P3: The new @note on lv_label_set_text_fmt is inaccurate. When LV_USE_ARABIC_PERSIAN_CHARS is enabled, lv_label_set_text_fmt formats via lv_text_set_text_vfmt, which runs lv_text_ap_proc on the result (lv_text.c:493-510), so the text IS Arabic/Persian processed. Change the note to state the text is modified, matching the lv_label_set_text note.</violation> </file> <file name="xmls/lv_textarea.xml"> <violation number="1" location="xmls/lv_textarea.xml:9"> P1: When the UI Editor emits `<lv_textarea placeholder_text="..."/>`, the runtime parser ignores the attribute because `lv_xml_textarea_apply` only handles `placeholder`, so the placeholder text is lost. Update the textarea parser to accept `placeholder_text` (while retaining `placeholder` for compatibility), or keep this metadata name aligned with the parser.</violation> </file> <file name="src/widgets/span/lv_span.h"> <violation number="1" location="src/widgets/span/lv_span.h:103"> P2: Calls to `lv_span_set_text_fmt` are not compiler-checked for format and argument mismatches because this declaration omits `LV_FORMAT_ATTRIBUTE`. Add the format attribute so invalid calls are diagnosed before the variadic formatter processes them.</violation> <violation number="2" location="src/widgets/span/lv_span.h:139"> P2: Calls to `lv_spangroup_set_span_text_fmt` are not compiler-checked for format and argument mismatches because this declaration omits `LV_FORMAT_ATTRIBUTE`. Add the attribute so invalid calls are diagnosed before the variadic formatter processes them.</violation> </file> <file name="src/others/observer/lv_observer.h"> <violation number="1" location="src/others/observer/lv_observer.h:548"> P1: When `LV_USE_LABEL` and `LV_USE_SPAN` differ, this declaration does not match the implementation: labels-only builds expose an undefined function, while spans-only builds hide the valid API. Guard this block with `LV_USE_SPAN`.</violation> <violation number="2" location="src/others/observer/lv_observer.h:551"> P3: The new Spangroup observer is documented as binding to a Label, although its `obj` and `span` parameters target a Spangroup span. Rename the summary so generated API documentation does not mislead users.</violation> </file> <file name="src/others/xml/parsers/lv_xml_obj_parser.c"> <violation number="1" location="src/others/xml/parsers/lv_xml_obj_parser.c:903"> P1: Every grid descriptor value writes the terminator past the allocated array. `item_cnt` is the number of spaces, but the split loop produces `item_cnt + 1` descriptors and then appends `LV_GRID_TEMPLATE_LAST`; allocate `item_cnt + 2` elements.</violation> </file> <file name="docs/src/details/auxiliary-modules/observer/observer.rst"> <violation number="1" location="docs/src/details/auxiliary-modules/observer/observer.rst:520"> P3: "both the spangroup and the span needs to be specified" is a subject-verb agreement error: the compound subject requires "need".</violation> <violation number="2" location="docs/src/details/auxiliary-modules/observer/observer.rst:581"> P3: "the Scale Section's are not interactive" misuses an apostrophe: it should be the plural "Sections" (with "one-way" hyphenated: "one-way binding").</violation> </file> <file name="src/others/observer/lv_observer.c"> <violation number="1" location="src/others/observer/lv_observer.c:836"> P2: When observer allocation fails, `lv_subject_add_observer_obj` returns `NULL`, but this function immediately dereferences it and leaks `user_data`. Check `observer` before setting `auto_free_user_data`, free `user_data`, and return `NULL`.</violation> </file> <file name="src/widgets/span/lv_span.c"> <violation number="1" location="src/widgets/span/lv_span.c:212"> P2: When this wrapper cannot allocate the formatted string, it returns without ending the variadic argument list. Call `va_end(args)` before returning on the failure path.</violation> <violation number="2" location="src/widgets/span/lv_span.c:216"> P2: When this wrapper formats a span more than once, it leaks the previous dynamically allocated text because the ownership check is inverted. Test `span->txt && span->static_flag == 0` before freeing the old text.</violation> </file> ``` </details> <sub>Reply with feedback, questions, or to request a fix.<br /><br />[Re-trigger cubic](https://www.cubic.dev/action/re-review/pr/drape-io/crbench-cubic-2026-09/106/ai_pr_review_github_delivery_45571967c5d1c190e2d6cfeb815686d3a6f1998097d107f9f566955c4cb36833?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F106)</sub> <!-- cubic:review-post:ai_pr_review_github_delivery_45571967c5d1c190e2d6cfeb815686d3a6f1998097d107f9f566955c4cb36833:2511c789a97fd7180b45fdafe98ef6383167d706:90449e3b-97da-577f-b121-3c55fd7f44b8 -->
cursor · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 medium ✓ exact
d2 medium ✓ exact
d3 medium ✗ —
valid · impact high
The free only runs when txt is NULL (a no-op); previously heap-allocated text (static_flag==0) is overwritten without being freed, leaking on each observer update. [grounded: tree src/widgets/span/lv_span.c] [consensus 5/5: valid=5]
valid · impact high
item_cnt counts spaces, so N items need N+1 slots plus the terminator, but only spaces+1 = N slots are allocated; writing the terminator overflows the buffer. [grounded: diff] [consensus 5/5: valid=5]
valid · impact medium
In lv_xml_style.c, style names are unprefixed (SET_STYLE_IF compares to #prop, and globals.xml declares grid_column_dsc_array), so the style_-prefixed comparison never matches. [grounded: diff] [consensus 5/5: valid=5]
valid · matches d2 · impact medium
valid · impact low
The declaration is guarded by LV_USE_LABEL while the definition uses LV_USE_SPAN. With label off and span on, the XML spangroup parser calls an undeclared function. [grounded: diff] [consensus 5/5: valid=5]
valid · matches d1 · impact medium
valid · impact low
The malloc'd array is stored only in the style; lv_style_reset during unregister does not free referenced arrays, so it leaks. It is reachable when a style attribute is spelled with the style_ prefix. [grounded: diff] [consensus 5/5: valid=5]
raw comments (8)
src/widgets/span/lv_span.c:218
### Span fmt leaks allocated text **High Severity** <!-- DESCRIPTION START --> The free condition in `lv_span_set_text_fmt` and `lv_spangroup_set_span_text_fmt` is inverted, so previously heap-allocated span text is never released. Observer span bindings call this on every subject update, so text leaks continuously. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: b4fc45df-52cf-4625-b4ae-055ecbef5f83 --> <!-- LOCATIONS START src/widgets/span/lv_span.c#L215-L218 src/widgets/span/lv_span.c#L273-L276 LOCATIONS END --> <details> <summary>Additional Locations (1)</summary> - [`src/widgets/span/lv_span.c#L273-L276`](https://github.com/drape-io/crbench-cursor-2026-09/blob/a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa/src/widgets/span/lv_span.c#L273-L276) </details> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjM0YzViNWZjLWZmMGUtNDk3Yi1iYjVjLTM0MjUwNWQyMWJiYyIsImVuY3J5cHRpb25LZXkiOiI5RlZZR29ick1GRHNBVC1Mci03OXB6Z1Y3UFl2UU1RYTRZd0QyUW1iVHlJIiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjM0YzViNWZjLWZmMGUtNDk3Yi1iYjVjLTM0MjUwNWQyMWJiYyIsImVuY3J5cHRpb25LZXkiOiI5RlZZR29ick1GRHNBVC1Mci03OXB6Z1Y3UFl2UU1RYTRZd0QyUW1iVHlJIiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwNiwiY29tbWl0U2hhIjoiYTdkZGY3NWVmZTNiYjJkYzEwNzZlMTdmZDBmM2EwNjVmMWI0ZmFhYSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
src/others/xml/parsers/lv_xml_obj_parser.c:920
### Grid array buffer overflow **High Severity** <!-- DESCRIPTION START --> Grid descriptor parsing sizes the array from the space count plus one, which is one short of the parsed items plus `LV_GRID_TEMPLATE_LAST`. Writing the terminator overruns the allocation for any normal value such as `100 50 25`. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: addbc977-6fb7-49b9-90cf-eb3accbc42fb --> <!-- LOCATIONS START src/others/xml/parsers/lv_xml_obj_parser.c#L896-L920 src/others/xml/lv_xml_style.c#L286-L309 LOCATIONS END --> <details> <summary>Additional Locations (1)</summary> - [`src/others/xml/lv_xml_style.c#L286-L309`](https://github.com/drape-io/crbench-cursor-2026-09/blob/a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa/src/others/xml/lv_xml_style.c#L286-L309) </details> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90Ojg4M2ViYmEzLTg1MGQtNDk3OC1hM2YwLTBmMDVmZTE2YTc2NSIsImVuY3J5cHRpb25LZXkiOiJpa3g0c01NYi1lYTMwcEh2MV9pNFdFWl9FeDhjUmJBdkhXbGVJaURFM1B3IiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90Ojg4M2ViYmEzLTg1MGQtNDk3OC1hM2YwLTBmMDVmZTE2YTc2NSIsImVuY3J5cHRpb25LZXkiOiJpa3g0c01NYi1lYTMwcEh2MV9pNFdFWl9FeDhjUmJBdkhXbGVJaURFM1B3IiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwNiwiY29tbWl0U2hhIjoiYTdkZGY3NWVmZTNiYjJkYzEwNzZlMTdmZDBmM2EwNjVmMWI0ZmFhYSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
src/others/xml/lv_xml_style.c:316
### Style grid property names mismatch **Medium Severity** <!-- DESCRIPTION START --> Style registration compares grid descriptor attributes against `style_grid_column_dsc_array` and `style_grid_row_dsc_array`, but style definitions use `grid_column_dsc_array` / `grid_row_dsc_array`. Those properties are treated as unsupported, so grid templates on XML styles are never applied. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 7c49cf8a-bce7-4889-92c3-87fbd16c55ae --> <!-- LOCATIONS START src/others/xml/lv_xml_style.c#L283-L316 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmZlZjkwYmRiLTM5ZTItNDNkZC04YTU2LTRiYzViMDdjOTA1YSIsImVuY3J5cHRpb25LZXkiOiJmbkJEVG52V2NhN09sR1lJNjlVTDUzeEU0WmJIdkVOLU5NRnhleTIxRzFJIiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmZlZjkwYmRiLTM5ZTItNDNkZC04YTU2LTRiYzViMDdjOTA1YSIsImVuY3J5cHRpb25LZXkiOiJmbkJEVG52V2NhN09sR1lJNjlVTDUzeEU0WmJIdkVOLU5NRnhleTIxRzFJIiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwNiwiY29tbWl0U2hhIjoiYTdkZGY3NWVmZTNiYjJkYzEwNzZlMTdmZDBmM2EwNjVmMWI0ZmFhYSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
src/layouts/grid/lv_grid.c:194
### Failed grid calc leaks memory **Medium Severity** <!-- DESCRIPTION START --> `grid_update` now returns immediately when `calc` fails, skipping `calc_free`. If `calc_rows` allocated track arrays and `calc_cols` then failed, those allocations are leaked. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 6bf4ec50-3071-4774-926b-68d2d6f58024 --> <!-- LOCATIONS START src/layouts/grid/lv_grid.c#L192-L194 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjRkNWZhYjQ0LTU1OGUtNDdkNS1iMTcxLTgyOGZkNGQ0MWVjYyIsImVuY3J5cHRpb25LZXkiOiJCXzdpOFNOQzgtejhoZUxJb2oyek1sTFZKV3NIYkppa0lEOU5JZFYwemhrIiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjRkNWZhYjQ0LTU1OGUtNDdkNS1iMTcxLTgyOGZkNGQ0MWVjYyIsImVuY3J5cHRpb25LZXkiOiJCXzdpOFNOQzgtejhoZUxJb2oyek1sTFZKV3NIYkppa0lEOU5JZFYwemhrIiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwNiwiY29tbWl0U2hhIjoiYTdkZGY3NWVmZTNiYjJkYzEwNzZlMTdmZDBmM2EwNjVmMWI0ZmFhYSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
src/others/observer/lv_observer.h:564
### Span bind uses wrong feature guard **Medium Severity** <!-- DESCRIPTION START --> `lv_spangroup_bind_span_text` is declared under `LV_USE_LABEL`, while the implementation is compiled under `LV_USE_SPAN`. Those options are independent, so the API can be declared without a definition or defined without a declaration. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 05222ecd-8826-4fd1-bc24-319989febbb8 --> <!-- LOCATIONS START src/others/observer/lv_observer.h#L547-L564 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjIyYzI0NTg1LWJlNGEtNGRlNS1hNmViLWMwZjczMzA3MzU5MyIsImVuY3J5cHRpb25LZXkiOiJLZmd4SVNZTzFGWmpwUnAybW9ISUpuLXRBcHZLMzVHazZqUzJBXzl4WXpZIiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjIyYzI0NTg1LWJlNGEtNGRlNS1hNmViLWMwZjczMzA3MzU5MyIsImVuY3J5cHRpb25LZXkiOiJLZmd4SVNZTzFGWmpwUnAybW9ISUpuLXRBcHZLMzVHazZqUzJBXzl4WXpZIiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwNiwiY29tbWl0U2hhIjoiYTdkZGY3NWVmZTNiYjJkYzEwNzZlMTdmZDBmM2EwNjVmMWI0ZmFhYSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
xmls/lv_textarea.xml:9
### Textarea placeholder attribute mismatch **Medium Severity** <!-- DESCRIPTION START --> The textarea schema now exposes `placeholder_text`, but `lv_xml_textarea_apply` still reads `placeholder`. XML that follows the schema will not set the placeholder. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 10036510-dece-41d5-afd5-8e5a8201b574 --> <!-- LOCATIONS START xmls/lv_textarea.xml#L8-L9 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90Ojk0NTc3ZDlhLTRlYzctNDJiYS1hNTYwLTlmMWE4MDFjNmFmOSIsImVuY3J5cHRpb25LZXkiOiJCRTQ5QXcxbXlnc3Fnakh4N0lsN1MzMm1JdHh5Mk5uTGw0Z3lzZEVYaE80IiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90Ojk0NTc3ZDlhLTRlYzctNDJiYS1hNTYwLTlmMWE4MDFjNmFmOSIsImVuY3J5cHRpb25LZXkiOiJCRTQ5QXcxbXlnc3Fnakh4N0lsN1MzMm1JdHh5Mk5uTGw0Z3lzZEVYaE80IiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwNiwiY29tbWl0U2hhIjoiYTdkZGY3NWVmZTNiYjJkYzEwNzZlMTdmZDBmM2EwNjVmMWI0ZmFhYSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
src/others/xml/lv_xml_style.c:316
### Style grid arrays are never freed **Low Severity** <!-- DESCRIPTION START --> XML style parsing allocates a grid descriptor array and stores only the pointer in the style. Unlike the object path, nothing frees that buffer when the style is reset, replaced, or unregistered. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: a6d5f7db-8ae6-48b0-b1e0-7ea9ea97ab36 --> <!-- LOCATIONS START src/others/xml/lv_xml_style.c#L292-L316 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjdmNGZlMjc4LTE5MmMtNDg3Mi1hZjczLTViNjNlNDE5MTY1MiIsImVuY3J5cHRpb25LZXkiOiJOTXVQTERQWnJHeFpPeUp2NTc3d2xVY2Q1QWRxNWdVUkpzVWFBSkh6eHQ0IiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjdmNGZlMjc4LTE5MmMtNDg3Mi1hZjczLTViNjNlNDE5MTY1MiIsImVuY3J5cHRpb25LZXkiOiJOTXVQTERQWnJHeFpPeUp2NTc3d2xVY2Q1QWRxNWdVUkpzVWFBSkh6eHQ0IiwiYnJhbmNoIjoicHItODE4ZDI1NDNjNyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjEwNiwiY29tbWl0U2hhIjoiYTdkZGY3NWVmZTNiYjJkYzEwNzZlMTdmZDBmM2EwNjVmMWI0ZmFhYSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
PR-level
<!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes using default effort and found 7 potential issues. <!-- BUGBOT_FIX_ALL --> <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo1MjQ3NDVjNy1hZGM2LTQ0ZGItYTM1Yi1iNTk3OTBjNTZlYTkiLCJlbmNyeXB0aW9uS2V5Ijoic1BmRGU2TTNRdXFOMkF1MFlzN0ljOEd1el9uMkYyb0tPeHd5LWNhR0JfQSIsImJyYW5jaCI6InByLTgxOGQyNTQzYzciLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <!-- /BUGBOT_FIX_ALL --> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN --> <sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).</sup> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END --> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a7ddf75efe3bb2dc1076e17fd0f3a065f1b4faaa. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
Drape (Deep Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 medium ✓ exact
d2 medium ✓ off by one
d3 medium ✓ exact
valid · impact medium
The condition is inverted. Dynamic text is never freed before span->txt is overwritten, so the old string leaks. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The function returns after va_start without calling va_end. This is undefined behavior per C. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The declaration is guarded by LV_USE_LABEL while the definition is under LV_USE_SPAN, so the two disagree whenever only one of the options is enabled. [grounded: tree src/others/observer/lv_observer.h] [consensus 3/3: valid=3]
valid · impact low
The lv_malloc result is used without a NULL check. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d3 · impact medium
valid · impact medium
lv_spangroup_set_span_text_fmt, which the bound observer uses, has the same inverted free condition, so every update leaks the previous string. [grounded: tree src/widgets/span/lv_span.c] [consensus 3/3: valid=3]
valid · impact medium
In the style parser, value may point to a constant's stored string (value = c->value), and lv_xml_split_str writes '\0' into that buffer, corrupting the constant. [grounded: tree src/others/xml/lv_xml_style.c] [consensus 3/3: valid=3]
valid · impact low
The array is heap-allocated and stored in the style, but no code path ever frees it. [grounded: tree src/others/xml/lv_xml_style.c] [consensus 3/3: valid=3]
valid · impact medium
The observer's lifetime is tied only to the spangroup. lv_spangroup_delete_span frees the span without removing the observer, so the next subject change writes into freed memory. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d2 · impact medium
valid · impact high
item_cnt counts spaces, so N spaces means N+1 tokens plus the terminator, which needs N+2 slots. Only N+1 are allocated, so the terminator is written one element past the end of the heap buffer. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
-btn_cnt is wrongly rejected, but the fallback (index 0) returns the same first button, so the only effect is a spurious warning. [grounded: diff] [consensus 3/5: valid=3, invalid=2]
valid · impact low
For a bare "fr" token, sub_value+3 points past the terminator, so the parse reads out of bounds. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d1 · impact medium
valid · impact low
lv_subject_add_observer_obj can return NULL, for example with an uninitialized subject. The new code then dereferences NULL and leaks user_data. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
lv_xml_atoi("content") yields 0 because it only accumulates digits, so a content track becomes 0 instead of LV_GRID_CONTENT. [grounded: diff] [consensus 3/3: valid=3]
raw comments (16)
src/widgets/span/lv_span.c:216
**Old span text leaks on every formatted update** The free condition is inverted (`txt == NULL && static_flag`), so a previously allocated dynamic text is never freed before `span->txt` is overwritten. Use `if(span->txt && span->static_flag == 0) lv_free(span->txt);`. ``` src/widgets/span/lv_span.c:216 if(span->txt == NULL && span->static_flag) { src/widgets/span/lv_span.c:217 lv_free(span->txt); src/widgets/span/lv_span.c:218 } src/widgets/span/lv_span.c:220 span->static_flag = 0; src/widgets/span/lv_span.c:237 if(span->txt && span->static_flag == 0) { src/widgets/span/lv_span.c:238 lv_free(span->txt); src/widgets/span/lv_span.c:239 span->txt = NULL; src/widgets/span/lv_span.c:240 } src/widgets/span/lv_span.c:182 if(span->txt == NULL || span->static_flag == 1) { src/widgets/span/lv_span.c:183 span->txt = lv_malloc(text_alloc_len); ```
src/widgets/span/lv_span.c:212
**va_end skipped when formatting fails** On allocation failure the function returns before `va_end(args)`, which is undefined behavior per the C standard. Call va_end right after lv_text_set_text_vfmt. The same mistake is at `src/widgets/span/lv_span.c:270`. ``` src/widgets/span/lv_span.c:208 va_list args; src/widgets/span/lv_span.c:209 va_start(args, fmt); src/widgets/span/lv_span.c:210 char * text = lv_text_set_text_vfmt(fmt, args); src/widgets/span/lv_span.c:211 LV_ASSERT_MALLOC(text); src/widgets/span/lv_span.c:212 if(text == NULL) return; src/widgets/span/lv_span.c:214 va_end(args); ```
src/others/observer/lv_observer.h:548
**Span bind prototype hidden when labels disabled** When LV_USE_SPAN=1 and LV_USE_LABEL=0, the prototype is missing, so the spangroup XML parser's call fails to compile. When LABEL=1 and SPAN=0, a prototype with no definition is exposed. Guard the declaration with LV_USE_SPAN. ``` src/others/observer/lv_observer.h:548 #if LV_USE_LABEL src/others/observer/lv_observer.h:550 /** src/others/observer/lv_observer.h:551 * Bind an integer, string, or pointer Subject to a Label. src/others/observer/lv_observer.h:552 * @param obj pointer to Spangroup src/others/observer/lv_observer.c:795 #if LV_USE_SPAN ```
src/others/xml/parsers/lv_xml_obj_parser.c:903
**Grid array allocation not checked for NULL** `dsc_array` from `lv_malloc` is written to without a NULL check. Return early if lv_malloc returns NULL. The same mistake is at `src/others/xml/lv_xml_style.c:293`. ``` src/others/xml/parsers/lv_xml_obj_parser.c:903 int32_t * dsc_array = lv_malloc((item_cnt + 1) * sizeof(int32_t)); /*+1 for LV_GRID_TEMPLATE_LAST*/ src/others/xml/parsers/lv_xml_obj_parser.c:905 char * value_buf = (char *)value; src/others/xml/parsers/lv_xml_obj_parser.c:906 item_cnt = 0; src/others/xml/parsers/lv_xml_obj_parser.c:907 const char * sub_value = lv_xml_split_str(&value_buf, ' '); ```
src/others/xml/parsers/lv_xml_tabview_parser.c:100
**Missing tab_button index crashes the parser** When the `index` attribute is omitted, `lv_xml_get_value_of` returns NULL and `lv_xml_atoi` dereferences it. Warn and return NULL (or use 0) when `index_str` is NULL. ``` src/others/xml/parsers/lv_xml_tabview_parser.c:99 const char * index_str = lv_xml_get_value_of(attrs, "index"); src/others/xml/parsers/lv_xml_tabview_parser.c:100 int32_t index_int = lv_xml_atoi(index_str); src/others/xml/lv_xml_utils.c:82 const char * s = *str; src/others/xml/lv_xml_utils.c:83 int32_t result = 0; src/others/xml/lv_xml_utils.c:84 int sign = 1; src/others/xml/lv_xml_utils.c:86 /* Skip leading whitespace */ src/others/xml/lv_xml_utils.c:87 while(*s == ' ' || *s == '\t') s++; ```
src/widgets/span/lv_span.c:274
**Bound span leaks old text every update** The free condition is inverted (`txt == NULL && static_flag`), so the previously allocated text is never freed before `span->txt` is overwritten. Every subject change through `lv_spangroup_bind_span_text` leaks a string. Use `if(span->txt && !span->static_flag) lv_free(span->txt);`. ``` src/widgets/span/lv_span.c:274 if(span->txt == NULL && span->static_flag) { src/widgets/span/lv_span.c:275 lv_free(span->txt); src/widgets/span/lv_span.c:276 } src/widgets/span/lv_span.c:278 span->static_flag = 0; src/widgets/span/lv_span.c:182 if(span->txt == NULL || span->static_flag == 1) { src/widgets/span/lv_span.c:183 span->txt = lv_malloc(text_alloc_len); src/widgets/span/lv_span.c:184 LV_ASSERT_MALLOC(span->txt); src/widgets/span/lv_span.c:185 } src/widgets/span/lv_span.c:186 else { src/widgets/span/lv_span.c:187 span->txt = lv_realloc(span->txt, text_alloc_len); ```
src/others/xml/lv_xml_style.c:297
**Style grid template corrupts shared constant string** When `value` comes from a `#const`, `lv_xml_split_str` writes into the constant's stored string. Any later style or widget that uses the same constant sees only the first token. Split a strdup'ed copy of the value. The same mistake is at `src/others/xml/parsers/lv_xml_obj_parser.c:907`. ``` src/others/xml/lv_xml_style.c:295 char * value_buf = (char *)value; src/others/xml/lv_xml_style.c:296 item_cnt = 0; src/others/xml/lv_xml_style.c:297 const char * sub_value = lv_xml_split_str(&value_buf, ' '); src/others/xml/lv_xml_style.c:298 while(sub_value) { src/others/xml/lv_xml_utils.c:272 while(*src_next != '\0') { src/others/xml/lv_xml_utils.c:273 if(*src_next == delimiter) { src/others/xml/lv_xml_utils.c:274 *src_next = '\0'; /*Close the string on the delimiter*/ src/others/xml/lv_xml_utils.c:275 *src = src_next + 1; /*Change the source continue after the found delimiter*/ src/others/xml/lv_xml_utils.c:276 return src_first; ```
src/others/xml/lv_xml_style.c:293
**XML style grid arrays are never freed** The `dsc_array` allocated for a registered style has no owner. Unregistering the component only calls `lv_style_reset`, and re-registering the same style name replaces the pointer without freeing the old array. Free the arrays when the style is freed or extended. ``` src/others/xml/lv_xml_style.c:293 int32_t * dsc_array = lv_malloc((item_cnt + 1) * sizeof(int32_t)); /*+1 for LV_GRID_TEMPLATE_LAST*/ src/others/xml/lv_xml_style.c:311 if(lv_streq(name, "style_grid_column_dsc_array")) { src/others/xml/lv_xml_style.c:312 lv_style_set_grid_column_dsc_array(style, dsc_array); src/others/xml/lv_xml_style.c:313 } src/others/xml/lv_xml_component.c:290 lv_xml_style_t * style; src/others/xml/lv_xml_component.c:291 LV_LL_READ(&scope->style_ll, style) { src/others/xml/lv_xml_component.c:292 lv_free((char *)style->name); src/others/xml/lv_xml_component.c:293 lv_free((char *)style->long_name); src/others/xml/lv_xml_component.c:294 lv_style_reset(&style->style); ```
src/others/observer/lv_observer.c:834
**Deleted bound span is written after free** The observer is tied to the spangroup's lifetime only, but it stores a raw `span` pointer. After `lv_spangroup_delete_span`, the next subject change writes text into the freed span. Remove observers bound to a span when it is deleted, or document that the caller must remove the observer first. ``` src/others/observer/lv_observer.c:832 user_data->element = span; src/others/observer/lv_observer.c:833 user_data->fmt = fmt; src/others/observer/lv_observer.c:835 lv_observer_t * observer = lv_subject_add_observer_obj(subject, span_text_observer_cb, obj, user_data); src/others/observer/lv_observer.c:836 observer->auto_free_user_data = 1; src/widgets/span/lv_span.c:149 lv_ll_remove(&spans->child_ll, cur_span); src/others/observer/lv_observer.c:450 observer->user_data = user_data; src/others/observer/lv_observer.c:451 observer->target = obj; src/others/observer/lv_observer.c:452 observer->for_obj = 1; src/others/observer/lv_observer.c:453 /* subscribe to delete event of the object */ src/others/observer/lv_observer.c:454 if(obj != NULL) { ```
src/layouts/grid/lv_grid.c:194
**Grid row arrays leak when column dsc missing** When `calc_rows` succeeds but `calc_cols` fails (no column descriptor on the container or its parent), `grid_update` now returns early without `calc_free`, so the row arrays leak on every layout pass. Call `calc_free(&c)` before returning, and have `calc` zero `c` up front so that freeing it is safe. ``` src/layouts/grid/lv_grid.c:193 lv_result_t res = calc(cont, &c); src/layouts/grid/lv_grid.c:194 if(res != LV_RESULT_OK) return; src/layouts/grid/lv_grid.c:241 if(calc_cols(cont, calc_out) == LV_RESULT_INVALID) { src/layouts/grid/lv_grid.c:242 /* Warning is already logged inside `calc_cols` */ src/layouts/grid/lv_grid.c:243 return LV_RESULT_INVALID; src/layouts/grid/lv_grid.c:271 static void calc_free(lv_grid_calc_t * calc) src/layouts/grid/lv_grid.c:272 { src/layouts/grid/lv_grid.c:273 lv_free(calc->x); src/layouts/grid/lv_grid.c:274 lv_free(calc->y); src/layouts/grid/lv_grid.c:275 lv_free(calc->w); ```
src/others/xml/parsers/lv_xml_obj_parser.c:903
**Grid descriptor array overflows by one element** The buffer holds spaces+1 ints, but a list with N spaces has N+1 items plus `LV_GRID_TEMPLATE_LAST`, so the terminator is written past the end of `dsc_array`. Allocate `(spaces + 2) * sizeof(int32_t)` (items = spaces + 1, plus terminator). ``` src/others/xml/parsers/lv_xml_obj_parser.c:897 uint32_t item_cnt = 0; src/others/xml/parsers/lv_xml_obj_parser.c:898 uint32_t i; src/others/xml/parsers/lv_xml_obj_parser.c:899 for(i = 0; value[i] != '\0'; i++) { src/others/xml/parsers/lv_xml_obj_parser.c:900 if(value[i] == ' ') item_cnt++; src/others/xml/lv_xml_utils.c:264 char * lv_xml_split_str(char ** src, char delimiter) src/others/xml/lv_xml_utils.c:265 { src/others/xml/lv_xml_utils.c:266 if(*src[0] == '\0') return NULL; src/others/xml/lv_xml_utils.c:268 char * src_first = *src; src/others/xml/lv_xml_utils.c:269 char * src_next = *src; src/others/xml/lv_xml_utils.c:271 /*Find the delimiter*/ ```
src/others/xml/parsers/lv_xml_tabview_parser.c:101
**Valid negative tab index -count rejected** `LV_ABS(index_int) >= btn_cnt` rejects `-btn_cnt`, which `lv_tabview_get_tab_button` accepts as the first button; the fallback is the same here, but the check is off by one for negatives. Check `index_int >= btn_cnt || index_int < -btn_cnt`. ``` src/others/xml/parsers/lv_xml_tabview_parser.c:100 int32_t index_int = lv_xml_atoi(index_str); src/others/xml/parsers/lv_xml_tabview_parser.c:101 if(LV_ABS(index_int) >= btn_cnt) { src/others/xml/parsers/lv_xml_tabview_parser.c:102 LV_LOG_WARN("tabindex is out of range, using the first tab instead"); src/others/xml/parsers/lv_xml_tabview_parser.c:103 index_int = 0; src/widgets/tabview/lv_tabview.h:91 /** src/widgets/tabview/lv_tabview.h:92 * Get a given tab button by index src/widgets/tabview/lv_tabview.h:93 * @param obj pointer to a tabview widget src/widgets/tabview/lv_tabview.h:94 * @param idx zero based index of the tab button to get. src/widgets/tabview/lv_tabview.h:95 * < 0 means start counting tab button from the back (-1 is the last tab button) src/widgets/tabview/lv_tabview.h:96 * @return pointer to the tab button, or NULL if the index was out of range ```
src/others/xml/parsers/lv_xml_obj_parser.c:909
**Bare "fr" token reads past the string** Any token that starts with "fr" is parsed from `sub_value + 3` with no check that "fr(" is actually there. A token such as "fr" makes it read past its terminator. Check for the "fr(" prefix with strncmp before skipping 3 characters. ``` src/others/xml/parsers/lv_xml_obj_parser.c:908 while(sub_value) { src/others/xml/parsers/lv_xml_obj_parser.c:909 if(sub_value[0] == 'f' && sub_value[1] == 'r') { src/others/xml/parsers/lv_xml_obj_parser.c:910 dsc_array[item_cnt] = LV_GRID_FR(lv_xml_atoi(sub_value + 3)); /*+3 to skip "fr("*/ src/others/xml/lv_xml_style.c:299 if(sub_value[0] == 'f' && sub_value[1] == 'r') { src/others/xml/lv_xml_utils.c:281 /*No delimiter found, return the string as it is*/ src/others/xml/lv_xml_utils.c:282 *src = src_next; /*Move the source point to the end*/ src/others/xml/lv_xml_utils.c:284 return src_first; ```
xmls/lv_textarea.xml:9
**Textarea `placeholder_text` from the schema is ignored** The schema renames the prop to `placeholder_text`, but `lv_xml_textarea_apply` still only matches `placeholder`. XML written against the new schema never sets the placeholder. Rename the parser's match to `placeholder_text`, or keep the schema name `placeholder`. ``` xmls/lv_textarea.xml:9 <prop name="placeholder_text" type="string" help=""/> src/others/xml/parsers/lv_xml_textarea_parser.c:59 else if(lv_streq("placeholder", name)) lv_textarea_set_placeholder_text(item, value); ```
src/others/observer/lv_observer.c:836
**Span binding dereferences NULL observer** `lv_subject_add_observer_obj` can return NULL (allocation failure or uninitialized subject), and `observer->auto_free_user_data` is then written without a check. `user_data` also leaks. If observer is NULL, free user_data and return NULL. ``` src/others/observer/lv_observer.c:835 lv_observer_t * observer = lv_subject_add_observer_obj(subject, span_text_observer_cb, obj, user_data); src/others/observer/lv_observer.c:836 observer->auto_free_user_data = 1; src/others/observer/lv_observer.c:438 if(subject->type == LV_SUBJECT_TYPE_INVALID) { src/others/observer/lv_observer.c:439 LV_LOG_WARN("Subject not initialized yet"); src/others/observer/lv_observer.c:440 return NULL; src/others/observer/lv_observer.c:441 } src/others/observer/lv_observer.c:442 lv_observer_t * observer = lv_ll_ins_tail(&(subject->subs_ll)); src/others/observer/lv_observer.c:443 LV_ASSERT_MALLOC(observer); src/others/observer/lv_observer.c:444 if(observer == NULL) return NULL; ```
src/others/xml/parsers/lv_xml_obj_parser.c:908
**`content` grid tracks parse as zero width** Only `fr(...)` and plain numbers are handled. A `content` track goes through `lv_xml_atoi` and becomes 0 instead of `LV_GRID_CONTENT` (the style parser has the same gap). Map `content` to `LV_GRID_CONTENT`. ``` src/others/xml/parsers/lv_xml_obj_parser.c:908 while(sub_value) { src/others/xml/parsers/lv_xml_obj_parser.c:909 if(sub_value[0] == 'f' && sub_value[1] == 'r') { src/others/xml/parsers/lv_xml_obj_parser.c:910 dsc_array[item_cnt] = LV_GRID_FR(lv_xml_atoi(sub_value + 3)); /*+3 to skip "fr("*/ src/others/xml/parsers/lv_xml_obj_parser.c:911 } src/others/xml/lv_xml_utils.c:98 /* Convert the string*/ src/others/xml/lv_xml_utils.c:99 while(*s != delimiter) { src/others/xml/lv_xml_utils.c:100 if(*s >= '0' && *s <= '9') { src/others/xml/lv_xml_utils.c:101 int32_t digit = *s - '0'; src/others/xml/lv_xml_utils.c:103 result = result * 10 + digit; src/others/xml/lv_xml_utils.c:104 s++; ```
Drape (Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 medium ✓ exact
d2 medium ✓ exact
d3 medium ✓ exact
valid · impact low
In both new fmt functions, va_start runs and then the function returns early when text is NULL, so va_end is never called. That is undefined behavior per the C standard. [grounded: tree src/widgets/span/lv_span.c] [consensus 3/3: valid=3]
valid · impact high
item_cnt counts spaces, so space-separated items number item_cnt+1. Allocating item_cnt+1 entries leaves no room for the terminator, so writing dsc_array[item_cnt] = LV_GRID_TEMPLATE_LAST lands one slot past the buffer. [grounded: tree src/others/xml/parsers/lv_xml_obj_parser.c] [consensus 3/3: valid=3]
valid · impact medium
The observer is tied only to the spangroup's lifetime. lv_spangroup_delete_span frees the span without removing the observer, so the next notification passes a freed span to lv_spangroup_set_span_text*. [grounded: tree src/others/observer/lv_observer.c] [consensus 3/3: valid=3]
valid · matches d2 · impact medium
valid · impact medium
lv_xml_split_str writes '\0' at each delimiter. In lv_xml.c, attribute values can point to shared const values or parent param values (item_attrs[i + 1] = const_value). Parsing those in place truncates the shared string for later uses. [grounded: tree src/others/xml/parsers/lv_xml_obj_parser.c] [consensus 3/3: valid=3]
valid · matches d3 · impact medium
valid · impact low
The new prototype is guarded by LV_USE_LABEL while the definition uses LV_USE_SPAN. With labels disabled and spans enabled, callers such as the spangroup XML parser get an implicit declaration. [grounded: diff-section src/others/observer/lv_observer.h] [consensus 3/3: valid=3]
valid · matches d1 · impact medium
valid · impact medium
This has the same off-by-one: it allocates spaces+1 entries but writes spaces+1 items plus the terminator. The array is also never freed. The branch runs whenever a style attribute named style_grid_*_dsc_array is given. [grounded: tree src/others/xml/lv_xml_style.c] [consensus 3/3: valid=3]
raw comments (9)
src/widgets/span/lv_span.c:214
**va_end skipped when formatting fails** If lv_text_set_text_vfmt returns NULL, the function returns before va_end(args). Same in lv_spangroup_set_span_text_fmt. Call va_end right after the vfmt call, before the NULL check. The same mistake is at `src/widgets/span/lv_span.c:271` and `src/widgets/span/lv_span.c:216`. ``` src/widgets/span/lv_span.c:209 va_start(args, fmt); src/widgets/span/lv_span.c:210 char * text = lv_text_set_text_vfmt(fmt, args); src/widgets/span/lv_span.c:211 LV_ASSERT_MALLOC(text); src/widgets/span/lv_span.c:212 if(text == NULL) return; ```
src/others/xml/parsers/lv_xml_obj_parser.c:900
**Grid dsc array overflows its buffer by one** item_cnt counts spaces, so N items allocate N entries, but N items plus the terminator need N+1. The LV_GRID_TEMPLATE_LAST write lands past the allocation. Allocate (item_cnt + 2) entries. ``` src/others/xml/parsers/lv_xml_obj_parser.c:894 else if(lv_streq(prop_name, "style_grid_column_dsc_array") || src/others/xml/parsers/lv_xml_obj_parser.c:895 lv_streq(prop_name, "style_grid_row_dsc_array")) { src/others/xml/parsers/lv_xml_obj_parser.c:897 uint32_t item_cnt = 0; src/others/xml/parsers/lv_xml_obj_parser.c:898 uint32_t i; src/others/xml/parsers/lv_xml_obj_parser.c:900 if(value[i] == ' ') item_cnt++; ```
src/others/observer/lv_observer.c:835
**Span binding keeps dangling pointer after span deleted** The observer stores the raw lv_span_t pointer and is only tied to the spangroup's lifetime. If lv_spangroup_delete_span removes that span, the next subject change writes to freed memory. Remove the observer when the span is deleted, or look the span up safely before use. ``` src/others/observer/lv_observer.c:831 user_data->subject = subject; src/others/observer/lv_observer.c:832 user_data->element = span; src/others/observer/lv_observer.c:833 user_data->fmt = fmt; src/others/observer/lv_observer.c:835 lv_observer_t * observer = lv_subject_add_observer_obj(subject, span_text_observer_cb, obj, user_data); src/others/observer/lv_observer.c:1190 static void span_text_observer_cb(lv_observer_t * observer, lv_subject_t * subject) ```
src/layouts/grid/lv_grid.c:194
**Grid update leaks row buffers on column failure** The new early return skips `calc_free` when `calc` fails. If `calc_rows` succeeded but `calc_cols` failed (no column descriptor), the row arrays stay allocated. It also skips LAYOUT_CHANGED. Free partial allocations in calc on failure. ``` src/layouts/grid/lv_grid.c:192 lv_grid_calc_t c; src/layouts/grid/lv_grid.c:193 lv_result_t res = calc(cont, &c); src/layouts/grid/lv_grid.c:194 if(res != LV_RESULT_OK) return; src/layouts/grid/lv_grid.c:279 static lv_result_t calc_cols(lv_obj_t * cont, lv_grid_calc_t * c) src/layouts/grid/lv_grid.c:280 { src/layouts/grid/lv_grid.c:282 const int32_t * col_templ; src/layouts/grid/lv_grid.c:283 col_templ = get_col_dsc(cont); src/layouts/grid/lv_grid.c:284 bool subgrid = false; src/layouts/grid/lv_grid.c:285 if(col_templ == NULL) { src/layouts/grid/lv_grid.c:286 lv_obj_t * parent = lv_obj_get_parent(cont); ```
src/others/xml/parsers/lv_xml_obj_parser.c:907
**Grid dsc parsing modifies attribute string in place** `lv_xml_split_str` writes '\0' into the const attribute value. When the value comes from a shared param (`${cols}`), later uses of the same value see only the first token. Parse a lv_strdup'd copy, and check malloc. ``` src/others/xml/parsers/lv_xml_obj_parser.c:900 if(value[i] == ' ') item_cnt++; src/others/xml/parsers/lv_xml_obj_parser.c:901 } src/others/xml/parsers/lv_xml_obj_parser.c:903 int32_t * dsc_array = lv_malloc((item_cnt + 1) * sizeof(int32_t)); /*+1 for LV_GRID_TEMPLATE_LAST*/ src/others/xml/parsers/lv_xml_obj_parser.c:905 char * value_buf = (char *)value; src/others/xml/lv_xml_utils.c:264 char * lv_xml_split_str(char ** src, char delimiter) src/others/xml/lv_xml_utils.c:265 { src/others/xml/lv_xml_utils.c:266 if(*src[0] == '\0') return NULL; src/others/xml/lv_xml_utils.c:268 char * src_first = *src; src/others/xml/lv_xml_utils.c:269 char * src_next = *src; src/others/xml/lv_xml_utils.c:271 /*Find the delimiter*/ ```
src/others/xml/parsers/lv_xml_tabview_parser.c:97
**Missing `index` attribute crashes tab_button parser** `lv_xml_atoi(index_str)` is called without checking that `index` was provided; `lv_xml_get_value_of` returns NULL when it's absent, and `lv_xml_atoi` dereferences it. Treat a NULL index_str as index 0. ``` src/others/xml/parsers/lv_xml_tabview_parser.c:99 const char * index_str = lv_xml_get_value_of(attrs, "index"); src/others/xml/lv_xml_utils.c:80 int32_t lv_xml_atoi_split(const char ** str, char delimiter) src/others/xml/lv_xml_utils.c:81 { src/others/xml/lv_xml_utils.c:82 const char * s = *str; src/others/xml/lv_xml_utils.c:83 int32_t result = 0; src/others/xml/lv_xml_utils.c:84 int sign = 1; src/others/xml/lv_xml_utils.c:86 /* Skip leading whitespace */ src/others/xml/lv_xml_utils.c:87 while(*s == ' ' || *s == '\t') s++; ```
src/others/observer/lv_observer.h:548
**Span bind prototype hidden when labels disabled** With LV_USE_SPAN=1 and LV_USE_LABEL=0, lv_spangroup_bind_span_text is defined but never declared, so callers such as the spangroup XML parser fail with an implicit declaration. Guard the prototype with `#if LV_USE_SPAN` and fix the "Label" doc text. ``` src/others/observer/lv_observer.h:548 #if LV_USE_LABEL src/others/observer/lv_observer.h:550 /** src/others/observer/lv_observer.h:551 * Bind an integer, string, or pointer Subject to a Label. src/others/observer/lv_observer.h:552 * @param obj pointer to Spangroup src/others/observer/lv_observer.c:795 #if LV_USE_SPAN ```
xmls/lv_textarea.xml:9
**Textarea schema renamed, parser still reads old name** The schema now declares `placeholder_text`, but `lv_xml_textarea_apply` still only matches `placeholder`. Tools generating XML from this schema will emit an attribute that is silently ignored. Rename the attribute in the parser too (optionally keep `placeholder` as an alias), or revert the schema. ``` xmls/lv_textarea.xml:9 <prop name="placeholder_text" type="string" help=""/> src/others/xml/parsers/lv_xml_textarea_parser.c:59 else if(lv_streq("placeholder", name)) lv_textarea_set_placeholder_text(item, value); ```
src/others/xml/lv_xml_style.c:289
**Grid dsc array buffer one element too small** Same off-by-one: allocation is spaces+1 entries but items+terminator needs spaces+2. Also the array is never freed. Allocate item count + 1 correctly and track for freeing. ``` src/others/xml/lv_xml_style.c:284 else if(lv_streq(name, "style_grid_column_dsc_array") || src/others/xml/lv_xml_style.c:285 lv_streq(name, "style_grid_row_dsc_array")) { src/others/xml/lv_xml_style.c:287 uint32_t item_cnt = 0; src/others/xml/lv_xml_style.c:288 uint32_t c; src/others/xml/lv_xml_utils.c:264 char * lv_xml_split_str(char ** src, char delimiter) src/others/xml/lv_xml_utils.c:265 { src/others/xml/lv_xml_utils.c:266 if(*src[0] == '\0') return NULL; src/others/xml/lv_xml_utils.c:268 char * src_first = *src; src/others/xml/lv_xml_utils.c:269 char * src_next = *src; src/others/xml/lv_xml_utils.c:271 /*Find the delimiter*/ ```
greptile · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 medium ✗ —
d2 medium ✗ —
d3 medium ✗ —
valid · impact high
The code counts spaces, so N tokens give N-1, and it allocates N entries. It then writes N tokens plus the terminator, which is one int32_t past the end of the heap buffer. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
A token that starts with 'fr' but is shorter than 3 characters makes sub_value+3 point past the NUL terminator, so the read goes out of bounds on malformed input. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The free only runs when txt is NULL, so a buffer the span already owns is overwritten without being freed. Every formatted update, including observer notifications, leaks the old buffer. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The header declares the function under #if LV_USE_LABEL, but the implementation is under #if LV_USE_SPAN. This mismatch breaks builds in configurations where the two settings differ. [grounded: tree src/others/observer/lv_observer.h] [consensus 3/3: valid=3]
valid · impact low
The new parser and its registration in lv_xml.c are guarded only by LV_USE_XML, and nothing forces LV_USE_SWITCH on. With LV_USE_SWITCH=0 the build fails. Existing parsers follow the same pattern, but this change is what adds the switch dependency. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The array allocated for a registered style is stored only in the style property. Unregistering only calls lv_style_reset, which does not free pointer values, so the array leaks. The obj parser path, by contrast, adds a delete callback to free it. [grounded: tree src/others/xml/lv_xml_style.c] [consensus 3/3: valid=3]
raw comments (7)
src/others/xml/lv_xml_style.c:309
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Grid array writes past allocation** For a normal descriptor such as `"100 1fr"`, this code allocates two entries because it counts spaces, then writes two tokens followed by `LV_GRID_TEMPLATE_LAST`. That final write is one `int32_t` past the heap allocation and can corrupt adjacent heap data. The same allocation pattern appears in `src/others/xml/parsers/lv_xml_obj_parser.c:897-920`.
src/others/xml/lv_xml_style.c:300
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Malformed fr tokens overread** This accepts any token beginning with `fr` and then parses from `sub_value + 3`. For a final token such as `"fr"`, that pointer is already beyond the terminating NUL, so `lv_xml_atoi` reads outside the string; if another token follows, it can instead consume bytes from that token. The duplicate parser in `src/others/xml/parsers/lv_xml_obj_parser.c:909-910` has the same problem.
src/widgets/span/lv_span.c:221
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Formatted updates leak text** The free condition only runs when `span->txt` is NULL, so it can do nothing beyond `lv_free(NULL)`. An existing owned string has non-NULL `txt` and `static_flag == 0`, meaning each repeated formatted update—including subject observer notifications—overwrites the pointer and leaks the previous buffer. The formatted spangroup setter repeats this at lines 274-279.
src/others/observer/lv_observer.h:562
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Span API uses wrong guard** This span-binding declaration is guarded by `LV_USE_LABEL`, while its implementation is guarded by the independently configurable `LV_USE_SPAN`. With span enabled and label disabled, callers cannot see the declaration. With label enabled and span disabled, the header exposes a function whose implementation is not built, causing an undefined reference when it is used.
src/others/xml/parsers/lv_xml_switch_parser.c:26
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Disabled switch breaks XML builds** This parser is compiled whenever XML is enabled, but it references switch types and APIs that are excluded when the independently configurable `LV_USE_SWITCH` is disabled. As a result, an `LV_USE_XML=1`, `LV_USE_SWITCH=0` configuration fails to compile because the orientation type, enum constants, and switch functions are unavailable.
src/others/xml/lv_xml_style.c:315
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> **Registered styles leak grid arrays** The grid style setters retain this allocated descriptor pointer, but registered XML styles do not track it for cleanup, and style reset does not free pointer-valued property data. Unregistering a scope therefore leaks every row or column descriptor allocated here. The object-local parser explicitly registers deletion cleanup, while this registered-style path has no equivalent ownership handling.
PR-level
<!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=66790238"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a>Confidence Score: 0/5</h2> The PR is not safe to merge because ordinary grid descriptors corrupt heap memory, repeated span updates leak memory, and supported feature configurations fail to build or expose inconsistent APIs. <h2>Findings</h2> 1. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;**Grid array writes past allocation** <a href="https://github.com/drape-io/crbench-greptile-2026-09/pull/106#discussion_r4059126075">▶</a> 2. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;**Malformed fr tokens overread** <a href="https://github.com/drape-io/crbench-greptile-2026-09/pull/106#discussion_r4059126080">▶</a> 3. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;**Formatted updates leak text** <a href="https://github.com/drape-io/crbench-greptile-2026-09/pull/106#discussion_r4059126086">▶</a> 4. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;**Span API uses wrong guard** <a href="https://github.com/drape-io/crbench-greptile-2026-09/pull/106#discussion_r4059126088">▶</a> 5. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;**Disabled switch breaks XML builds** <a href="https://github.com/drape-io/crbench-greptile-2026-09/pull/106#discussion_r4059126090">▶</a> 6. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;**Registered styles leak grid arrays** <a href="https://github.com/drape-io/crbench-greptile-2026-09/pull/106#discussion_r4059126094">▶</a> <h3>Summary</h3> This PR expands observer bindings and XML widget/style support, adds formatted span text APIs and tab-button access, and fixes several XML metadata and documentation issues. - Adds subject bindings for span text and scale-section bounds. - Adds XML support for switches, tabview buttons, and grid descriptor arrays. - Introduces formatted span setters and a tabview button accessor. - Contains blocking memory-safety, ownership, and feature-configuration defects in the newly added paths. <details open><summary>Diagram</summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart LR XML[XML attributes] --> Parser[XML style/object parser] Parser --> Grid[Allocated grid descriptor array] Grid --> Style[Object or registered style] Subject[Observer subject update] --> Observer[Span observer callback] Observer --> Format[Formatted span setter] Format --> Text[Owned span text] Config[LV_USE_XML / widget feature flags] --> Parsers[Compiled XML widget parsers] ``` </details> <sub>Reviews (1) · Last reviewed commit: ["Update docs/src/details/auxiliary-module..."](https://github.com/drape-io/crbench-greptile-2026-09/commit/2bd7db95233a17e77b5ad4ac60dedae65d009bb9)</sub>
Mjolnir (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 medium ✗ —
d2 medium ✓ off by one
d3 medium ✗ —
valid · impact medium
The free condition only holds when txt is NULL, so a heap-allocated old text is overwritten and never freed. span_text_observer_cb calls this setter on every subject update, so each update leaks. The early return also skips va_end. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
resolve_consts in lv_xml.c sets item_attrs[i + 1] to the stored const_value. lv_xml_split_str then writes NUL bytes into that shared constant, which truncates it for every later use. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The prototype is guarded by LV_USE_LABEL while the definition uses LV_USE_SPAN. With LV_USE_SPAN=1 and LV_USE_LABEL=0, the call in lv_xml_spangroup_parser.c has no declaration in scope. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
Same as finding 0: the inverted condition means the previous heap text is never freed, so a bound span leaks on every notification. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
Same as finding 1: the split runs in place on a value that can point to shared const or param storage, so that storage gets truncated. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d2 · impact medium
valid · impact low
The guard mismatch between the declaration (LV_USE_LABEL) and the definition (LV_USE_SPAN) causes an implicit declaration or a link error depending on the config. [grounded: diff] [consensus 3/3: valid=3]
raw comments (7)
src/widgets/span/lv_span.c:274
[P1] Old span text is never freed when formatted text is set In `lv_spangroup_set_span_text_fmt` (and the same code in `lv_span_set_text_fmt` at lines 216-218), the free condition is `span-›txt == NULL && span-›static_flag`. That condition can never free anything: it is only true when the pointer is NULL, and then `lv_free(NULL)` does nothing. When the span already holds a heap string (`txt != NULL`, `static_flag == 0`), the old buffer is overwritten without being freed. The new `span_text_observer_cb` calls this on every subject change, so a span bound with `bind_text`/`fmt` leaks one string per update. The check should be `span-›txt != NULL && !span-›static_flag`. Also, the early `return` when `text == NULL` skips `va_end`.
src/others/xml/parsers/lv_xml_obj_parser.c:906
[P2] Grid dsc parsing permanently changes `#const` / `$param` values The new `style_grid_column_dsc_array`/`style_grid_row_dsc_array` handling casts the attribute value to `char *` and runs `lv_xml_split_str` on it directly. That function writes `'\0'` over each space. The value may come from `resolve_consts`/`resolve_params`, which replace it with a pointer to the stored constant (`cnst-›value`) or the stored param default. For example, `style_grid_column_dsc_array="#cols"` truncates the shared constant to its first token. Every later widget or style that uses `#cols` then gets a one-column grid. The same in-place split is in `lv_xml_style_register` (src/others/xml/lv_xml_style.c:296-307), which also resolves `#` constants to `c-›value`. Other callers, such as the gradient and selector parsing, copy the string into a local buffer before splitting.
src/others/observer/lv_observer.h:548
[P3] `lv_spangroup_bind_span_text` is declared under the wrong guard The prototype is wrapped in `#if LV_USE_LABEL`, but the definition in lv_observer.c is under `#if LV_USE_SPAN`. With `LV_USE_SPAN=1` and `LV_USE_LABEL=0`, the function is not declared for callers such as `lv_xml_spangroup_parser.c`. That gives an implicit-declaration error or warning. The guard should be `LV_USE_SPAN`; the doc comment also says "Bind ... to a Label".
src/widgets/span/lv_span.c:991
[P2] New span fmt setters never free the previous text (inverted condition) In `lv_spangroup_set_span_text_fmt` (and identically in `lv_span_set_text_fmt` at lines 961-963), the old text is freed only when `span-›txt == NULL && span-›static_flag`. That is the opposite of the intended `span-›txt != NULL && !span-›static_flag`, so a dynamically allocated previous text is never freed. `lv_span_set_text` does this correctly. Every call leaks the old string. Because `lv_spangroup_bind_span_text` calls this setter on each subject notification for INT/FLOAT subjects and for any subject with a format string, a span bound to a frequently changing subject leaks memory steadily until the heap runs out.
src/others/xml/parsers/lv_xml_obj_parser.c:594
[P2] Grid template parsing writes NUL bytes into shared XML constant/parameter strings `lv_xml_split_str` modifies its input by writing `'\0'` at each space, and the new `style_grid_column_dsc_array`/`style_grid_row_dsc_array` handling passes it `(char *)value` directly. `resolve_consts`/`resolve_params` in lv_xml.c point `value` at the stored constant (`lv_xml_get_const`) or the parameter default, which are shared and persistent. So with `style_grid_column_dsc_array="#cols"`, the first widget truncates the constant to its first token, and every later widget (or later instance of the component) gets only one column/row. The same issue is in `lv_xml_style_register` (src/others/xml/lv_xml_style.c:496-498), where `value` can be `c-›value` from the scope's `const_ll`. The value should be copied before it is split.
src/layouts/grid/lv_grid.c:193
[P3] Early return in grid_update leaks row arrays when column calc fails `calc()` runs `calc_rows` (which allocates `c.y`/`c.h`) and only then `calc_cols`. When a container has a row descriptor but no column descriptor (and neither does its parent), `calc` returns `LV_RESULT_INVALID` with the row arrays still allocated. The new `if(res != LV_RESULT_OK) return;` skips `calc_free(&c)`, so those arrays leak on every layout pass of that container. The new return also skips `LV_EVENT_LAYOUT_CHANGED` and the content-size refresh when a grid has no children (e.g. after its last child is deleted), which the old code still performed.
src/others/observer/lv_observer.h:377
[P3] lv_spangroup_bind_span_text is declared under the wrong config guard The prototype is wrapped in `#if LV_USE_LABEL`, but the definition in lv_observer.c is under `#if LV_USE_SPAN`. With `LV_USE_SPAN=1` and `LV_USE_LABEL=0`, lv_xml_spangroup_parser.c calls the function without a prototype in scope (implicit declaration, which is an error on modern compilers). With `LV_USE_LABEL=1` and `LV_USE_SPAN=0`, the API is declared but not defined, so a call fails at link time. The guard should be `LV_USE_SPAN`.
Mjolnir (Sonnet 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 medium ✗ —
d2 medium ✗ —
d3 medium ✓ exact
valid · impact medium
The guard only matches when txt is NULL, so it never frees a previously heap-allocated non-static text. That old text is then overwritten and leaked on every call, including every update from the new span bind observer. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The prototype is guarded by LV_USE_LABEL, but the definition and the XML caller are under LV_USE_SPAN. With SPAN=1 and LABEL=0 the prototype is missing, so the call becomes an implicit declaration. The undefined-lv_span_t sub-claim is wrong because lv_types.h forward-declares lv_span_t, but the main claim stands. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d3 · impact medium
valid · impact medium
Same inverted free condition, which leaks the old text on every update. It is also true that the early `if(text == NULL) return;` comes before va_end(args). [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
Wrong config guard on the declaration: with SPAN=1 and LABEL=0 the prototype is missing, so the XML parser's call is an implicit declaration. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
In the style-register path the array is malloc'd and stored in the style with no NULL check and no free; component unregister only calls lv_style_reset. The obj-parser path does register a free callback. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
calc() returns LV_RESULT_INVALID when the container has no children. Before this change, grid_update still reached lv_obj_refr_size and sent LV_EVENT_LAYOUT_CHANGED in that case; now it returns early and skips both. [grounded: diff] [consensus 3/3: valid=3]
raw comments (7)
src/widgets/span/lv_span.c:961
[P1] Inverted free condition leaks the previous span text on every update (same logic at 991-993 in `lv_spangroup_set_span_text_fmt`) The guard `if(span-›txt == NULL && span-›static_flag) lv_free(span-›txt)` is inverted. It should free only when `txt != NULL && static_flag == 0`, as `lv_span_set_text_static` does. As written it never frees a heap-allocated old text (the condition is true only for a NULL, static span). It then overwrites `span-›txt` with the new buffer. Each call to `lv_span_set_text_fmt` / `lv_spangroup_set_span_text_fmt` therefore leaks the previous string. The new `bind_text` observer on spans calls this on every subject change, so a bound span leaks continuously.
src/others/observer/lv_observer.h:548
[P2] Span bind API is guarded by the wrong feature macro The `lv_spangroup_bind_span_text` declaration is wrapped in `#if LV_USE_LABEL`, but the implementation in lv_observer.c is under `#if LV_USE_SPAN`, and the signature uses `lv_span_t`. With `LV_USE_SPAN=1` and `LV_USE_LABEL=0`, the function is defined without a declaration, and the XML spangroup parser calls it. With `LV_USE_LABEL=1` and `LV_USE_SPAN=0`, the header declares a function that takes an undefined `lv_span_t` type, which may fail to compile. The guard should be `LV_USE_SPAN`.
src/others/xml/parsers/lv_xml_tabview_parser.c:852
[P2] NULL `index` attribute is dereferenced in `lv_xml_tabview_tab_button_create` `lv_xml_get_value_of(attrs, "index")` returns NULL when the attribute is missing. The result is passed straight to `lv_xml_atoi`, which dereferences the string without a NULL check. A `‹lv_tabview-tab_button/›` element without `index` crashes the XML load instead of falling back to the first tab. The out-of-range path right below it shows the intent is to degrade gracefully.
src/widgets/span/lv_span.c:961
[P1] Old span text leaked on every formatted update (same pattern at 991-993 in `lv_spangroup_set_span_text_fmt`) The free condition is inverted: `if(span-›txt == NULL && span-›static_flag) lv_free(span-›txt);` frees only when `txt` is NULL, which is a no-op. It never frees a previously allocated, non-static `txt`. Each call to `lv_span_set_text_fmt` / `lv_spangroup_set_span_text_fmt` therefore leaks the previous string. When the subject changes, the new `lv_spangroup_bind_span_text` observer calls `lv_spangroup_set_span_text_fmt` every time, so the leak repeats on every update. The condition should be `span-›txt && !span-›static_flag`. Also, the early `return` on a NULL `text` skips `va_end(args)`.
src/others/observer/lv_observer.h:548
[P2] Span bind declaration is guarded by the wrong config macro `lv_spangroup_bind_span_text` is declared under `#if LV_USE_LABEL`, but it is defined and used under `#if LV_USE_SPAN` (lv_observer.c:795, lv_xml_spangroup_parser.c). With `LV_USE_SPAN=1` and `LV_USE_LABEL=0`, the prototype is missing, so the XML parser's call is an implicit declaration. With `LV_USE_LABEL=1` and `LV_USE_SPAN=0`, the prototype refers to `lv_span_t`, which is not declared. The guard should be `LV_USE_SPAN`.
src/others/xml/lv_xml_style.c:494
[P2] Grid descriptor array from a style is allocated but never freed In `lv_xml_style_register`, the `lv_malloc`'d `dsc_array` is stored in the style with `lv_style_set_grid_*_dsc_array`, and nothing ever frees it. The object-parser path registers a delete callback for the same array, but this path does not. The `lv_malloc` result is also not checked for NULL before it is written to. Every XML style that uses `style_grid_column_dsc_array` or `style_grid_row_dsc_array` leaks one allocation.
src/layouts/grid/lv_grid.c:192
[P3] Early return in grid_update skips size refresh and layout-changed event `calc()` returns `LV_RESULT_INVALID` whenever the grid container has no children. `grid_update` now returns early in that case. It no longer reaches the `lv_obj_refr_size(cont)` call for `LV_SIZE_CONTENT` containers or the `LV_EVENT_LAYOUT_CHANGED` event. A content-sized grid whose last child was just removed keeps its stale size, and listeners are not notified. Before this change those steps still ran in that case.
qodo · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
DefectSeverityFoundGrade
d1 medium ✗ —
d2 medium ✗ —
d3 medium ✓ exact
valid · impact high
item_cnt counts spaces, so N spaces gives N+1 tokens; N+1 slots are allocated, but N+1 tokens plus the terminator are written, so the terminator overflows the buffer by one entry. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
lv_xml_split_str writes '\0' over each delimiter. In lv_xml_style_register, value can be swapped for a scope constant's c->value, so splitting it permanently truncates that shared constant. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
Style register matches unprefixed names (SET_STYLE_IF(grid_column_align...)), and globals.xml declares grid_column_dsc_array, so the style_-prefixed check never matches on <style> elements. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The observer's lifetime is tied only to the spangroup. lv_spangroup_delete_span frees the span, but the observer keeps user_data->element and uses the freed span on the next notification. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
The header declares lv_spangroup_bind_span_text under LV_USE_LABEL, while the implementation and the XML caller are under LV_USE_SPAN, so builds that enable only one of the two flags are inconsistent. [grounded: tree src/others/observer/lv_observer.h] [consensus 3/3: valid=3]
valid · impact low
lv_subject_add_observer_obj returns NULL for an uninitialized subject or a failed allocation; the new code dereferences the result without a check and leaks user_data. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
LVGL.lvgl.pdsc lists the other parsers (arc, label) but not lv_xml_switch_parser.c, so CMSIS-Pack builds with XML enabled fail to link. [grounded: diff] [consensus 3/3: valid=3]
valid · matches d3 · impact medium
valid · impact low
lv_obj_get_child_by_type accepts -btn_cnt as the first child, but this check rejects it and falls back to index 0. Because -btn_cnt is that first child anyway, the result is the same button and only a spurious warning is logged. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
Both new formatted setters return before va_end(args) when allocation fails. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The bind functions never check section, and the callback runs immediately. lv_scale_set_section_min_value only does LV_ASSERT_NULL before dereferencing, so a NULL section crashes when asserts are disabled. [grounded: diff] [consensus 3/3: valid=3]
valid · impact medium
This condition never frees an existing dynamically allocated txt (that needs txt != NULL && static_flag == 0), so every formatted update leaks the previous text. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
The code writes through dsc_array without checking it for NULL after lv_malloc. [grounded: diff] [consensus 3/3: valid=3]
valid · impact low
In the style-register path, dsc_array has no owner and nothing ever frees it. The obj parser path frees its copy with a delete event; this path does not. [grounded: diff] [consensus 3/3: valid=3]
raw comments (16)
src/others/xml/lv_xml_style.c:293
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 1\. Grid descriptors overflow the heap <code>🐞 Bug</code> <code>⛨ Security</code> <pre> The two grid descriptor parsers allocate only <b><i>space_count + 1</i></b> entries and then append <b><i>LV_GRID_TEMPLATE_LAST</i></b> after writing up to <b><i>space_count + 1</i></b> tokens. Every normally formatted descriptor therefore writes at least its terminator beyond the allocated buffer, which later grid layout processing reads. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description Both XML grid descriptor parsers allocate space for the parsed tokens but not for the required `LV_GRID_TEMPLATE_LAST` terminator, causing a heap-buffer overflow. ## Fix Focus Areas - src/others/xml/lv_xml_style.c[287-309] - src/others/xml/parsers/lv_xml_obj_parser.c[897-920] ## Recommended Fix Count actual tokens and allocate one additional `int32_t` for the terminator in both parsers. Ensure empty or repeated delimiters cannot produce more writes than the allocated capacity. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/xml/lv_xml_style.c:297
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 2\. Grid parsing mutates constant input <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> Both grid descriptor parsers cast each <b><i>const char *value</i></b> to writable storage and pass it to <b><i>lv_xml_split_str</i></b>, which replaces delimiters with null terminators. Read-only attribute strings can fault, ordinary parsing mutates parser-owned storage, and named XML constants are permanently truncated so later uses receive only the first grid item. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The grid descriptor parsers cast away the attribute API's const qualifier and use a destructive tokenizer on potentially read-only or shared storage, which can corrupt retained XML constant values after their first use. ## Fix Focus Areas - src/others/xml/lv_xml_style.c[294-309] - src/others/xml/parsers/lv_xml_obj_parser.c[904-920] - src/others/xml/lv_xml_utils.c[264-274] ## Recommended Fix Duplicate the descriptor `value` into temporary writable allocated storage before calling `lv_xml_split_str`, construct the integer descriptor array from that copy, and free the temporary buffer on every success and failure path in both the style and object parsing paths. Leave the source attribute or constant unchanged; alternatively, replace the destructive split with non-destructive token scanning over the const input. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/xml/lv_xml_style.c:285
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 3\. Named grid styles remain unsupported <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> <b><i>lv_xml_style_register</i></b> compares named-style attributes against <b><i>style_grid_column_dsc_array</i></b> and <b><i>style_grid_row_dsc_array</i></b>, even though named styles receive the unprefixed property names <b><i>grid_column_dsc_array</i></b> and <b><i>grid_row_dsc_array</i></b>. Valid grid template attributes on XML <b><i>&lt;style&gt;</i></b> elements therefore fall through as unsupported and never configure or affect the layout. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description Named XML styles use the unprefixed properties `grid_column_dsc_array` and `grid_row_dsc_array`, but the new parser branch expects object-property names with a `style_` prefix, so valid grid descriptor attributes on XML style definitions are not recognized. ## Fix Focus Areas - src/others/xml/lv_xml_style.c[284-317] - xmls/globals.xml[314-316] ## Recommended Fix Update `lv_xml_style_register` to match `grid_column_dsc_array` and `grid_row_dsc_array`, consistent with the style-definition schema and the parser's other unprefixed style properties. Retain the `style_`-prefixed names only in the object-property parser, where object attributes use them. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/observer/lv_observer.c:835
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 4\. Deleted spans remain observable <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> <b><i>lv_spangroup_bind_span_text</i></b> stores a raw, separately deletable span pointer in observer data while tying observer cleanup only to the containing spangroup. If that span is deleted while the spangroup remains alive, subsequent subject notifications reuse the freed pointer and pass it to the span text setter. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description Span text observers can outlive individually deleted spans because observer cleanup is associated only with the containing spangroup. A later subject notification can therefore pass a freed span pointer to the span text setter. ## Fix Focus Areas - src/others/observer/lv_observer.c[827-838] - src/others/observer/lv_observer.c[1190-1216] - src/widgets/span/lv_span.c[113-130] - src/widgets/span/lv_span.c[137-153] ## Recommended Fix Associate each span-text binding with the lifetime of its span and remove the corresponding observer before `lv_spangroup_delete_span` frees that span. This may require tracking bound observers on each span or adding a span-deletion cleanup hook; alternatively, make the binding callback verify that the span is still owned by the target spangroup before using it. Ensure that the observer's auto-freed binding data is released when the observer is removed. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/observer/lv_observer.h:550
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 5\. Span configurations fail to link <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> The new span-binding declaration is guarded by <b><i>LV_USE_LABEL</i></b>, while its implementation and XML caller are guarded by <b><i>LV_USE_SPAN</i></b>. With spans and XML enabled but labels disabled, the caller compiles without a declaration; with labels enabled but spans disabled, the header exposes a function whose implementation is not compiled. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The public span observer API declaration is conditionally guarded by the unrelated label feature flag, even though spans are independently configurable and the XML span parser calls the API when span support is enabled. ## Fix Focus Areas - src/others/observer/lv_observer.h[548-564] - src/others/observer/lv_observer.c[795-840] - src/others/xml/parsers/lv_xml_spangroup_parser.c[91-103] ## Recommended Fix Change the declaration's feature guard from `LV_USE_LABEL` to `LV_USE_SPAN` so the declaration, implementation, callback, and callers are compiled under the same configuration. Keep the API unavailable only when span support itself is disabled. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/observer/lv_observer.c:836
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 7\. Binding allocation failure crashes <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> <b><i>lv_spangroup_bind_span_text</i></b> unconditionally dereferences the nullable result of <b><i>lv_subject_add_observer_obj</i></b> after allocating its binding user data. If observer-node allocation fails, <b><i>observer</i></b> is <b><i>NULL</i></b>, and the binding data remains unreleased because automatic user-data cleanup only applies to a successfully created observer. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The span binding assumes observer registration always succeeds and dereferences a nullable result, leaking its newly allocated user data when registration fails. ## Fix Focus Areas - src/others/observer/lv_observer.c[824-838] - src/others/observer/lv_observer.c[429-451] ## Recommended Fix Check whether `lv_subject_add_observer_obj` returned `NULL` before accessing `observer`. On failure, free the newly allocated `user_data` and return `NULL`; set `auto_free_user_data` only after registration succeeds. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/xml/lv_xml.c:118
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> 6\. Cmsis xml builds fail linking <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> <b><i>lv_xml_init</i></b> now references the switch parser functions, but the CMSIS-Pack manifest does not include the new parser source file. Enabling the packaged XML component therefore compiles the registration call without either function definition and fails at link time. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The explicit CMSIS-Pack XML source manifest omits the newly registered switch parser implementation. ## Fix Focus Areas - src/others/xml/lv_xml.c[115-119] - env_support/cmsis-pack/LVGL.lvgl.pdsc[1766-1790] ## Recommended Fix Add `src/others/xml/parsers/lv_xml_switch_parser.c` to the XML parser file list in `LVGL.lvgl.pdsc`, alongside the other widget parser sources. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/xml/parsers/lv_xml_tabview_parser.c:100
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 8\. Missing tab index crashes parsing <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> <b><i>lv_xml_tabview_tab_button_create</i></b> passes the nullable result of `lv_xml_get_value_of(attrs, &quot;index&quot;)<b><i> directly to </i></b>lv_xml_atoi`. An XML tab-button element missing that attribute therefore dereferences <b><i>NULL</i></b> instead of being rejected or receiving a default. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The tab-button XML parser converts a missing `index` attribute without checking for null. ## Fix Focus Areas - src/others/xml/parsers/lv_xml_tabview_parser.c[99-106] ## Recommended Fix Check `index_str` before conversion. Log a clear warning and return `NULL`, or explicitly default to index zero, consistently with the XML API contract. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/xml/parsers/lv_xml_tabview_parser.c:104
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 9\. Valid reverse tab indexes reset <code>🐞 Bug</code> <code>≡ Correctness</code> <pre> The tab-button parser rejects <b><i>LV_ABS(index_int) &gt;= btn_cnt</i></b>, although the underlying child lookup accepts <b><i>-btn_cnt</i></b> as the first button. This makes <b><i>-1</i></b> invalid for a one-tab view and silently selects the first tab for otherwise valid reverse indexes at the lower boundary. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The tab-button XML range check rejects the documented negative index that addresses the first child from the back. ## Fix Focus Areas - src/others/xml/parsers/lv_xml_tabview_parser.c[101-106] - src/widgets/tabview/lv_tabview.h[91-98] ## Recommended Fix Validate positive and negative ranges separately: accept `0` through `btn_cnt - 1` and `-1` through `-btn_cnt`. Avoid `LV_ABS` so the check also remains safe for the minimum integer value. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/widgets/span/lv_span.c:212
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 10\. Formatting failure skips cleanup <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> Both new variadic span setters return after a formatting allocation failure without calling <b><i>va_end(args)</i></b>. Platforms where variadic traversal requires cleanup therefore encounter undefined behavior specifically on the new out-of-memory path. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The new formatted span setters bypass `va_end` when text allocation fails. ## Fix Focus Areas - src/widgets/span/lv_span.c[208-215] - src/widgets/span/lv_span.c[266-273] ## Recommended Fix Call `va_end(args)` immediately after `lv_text_set_text_vfmt` and before testing the returned allocation, or use a shared cleanup path in both functions. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/observer/lv_observer.c:921
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 11\. Null scale sections crash binding <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> The new scale-section bind functions validate the subject and scale but not the section pointer, then invoke their observer callback immediately during registration. A failed section allocation or direct null argument therefore reaches the section setter with <b><i>NULL</i></b> and dereferences it. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The new scale-section observer APIs accept a null section even though registration immediately invokes a callback that requires a valid section. ## Fix Focus Areas - src/others/observer/lv_observer.c[917-929] - src/others/observer/lv_observer.c[932-944] - src/others/xml/parsers/lv_xml_scale_parser.c[108-125] ## Recommended Fix Assert and runtime-check `section` in both public bind functions before registering the observer. Ensure the XML section creation path does not apply attributes when section allocation failed. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/widgets/span/lv_span.c:220
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 12\. Formatted span updates leak text <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> Both formatted span setters replace <b><i>span-&gt;txt</i></b> but free it only when `span-&gt;txt == NULL &amp;&amp; span-&gt;static_flag`, a condition that excludes existing dynamically owned buffers. Every subsequent successful formatted update through either setter abandons the previous rendered allocation. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The formatted span setters use an inverted ownership condition and overwrite dynamically owned span text without freeing it, leaking one allocation for each successful formatted update after the first. ## Fix Focus Areas - src/widgets/span/lv_span.c[202-222] - src/widgets/span/lv_span.c[260-282] ## Recommended Fix Before assigning the newly formatted buffer, free the old value when `span->txt != NULL` and `span->static_flag == 0`. Apply the same ownership transition in both formatted setters, and do not free static text. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/xml/lv_xml_style.c:296
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 13\. Grid parsing crashes under memory pressure <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> Both new grid descriptor parsers write parsed values and the terminator through <b><i>dsc_array</i></b> immediately after <b><i>lv_malloc</i></b> without checking whether it returned <b><i>NULL</i></b>. Under memory pressure, allocation failure in either XML style or object processing reaches the first indexed write and dereferences the null pointer. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description The new XML grid descriptor parsers do not handle descriptor allocation failure before writing parsed values or the terminator through the returned pointer. ## Fix Focus Areas - src/others/xml/lv_xml_style.c[293-309] - src/others/xml/parsers/lv_xml_obj_parser.c[903-920] ## Recommended Fix Check `dsc_array` immediately after each `lv_malloc`, before parsing values or writing the terminator. If it is `NULL`, log or assert according to the project's allocation-failure convention, then return an invalid result or skip applying the property/descriptor without modifying the style; apply the same handling in both parsers. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
src/others/xml/lv_xml_style.c:317
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> 14\. Style grid arrays are never freed <code>🐞 Bug</code> <code>☼ Reliability</code> <pre> <b><i>lv_xml_style_register</i></b> allocates grid descriptor arrays and stores their raw pointers in an <b><i>lv_style_t</i></b> without registering ownership or cleanup. Re-registering or extending a same-named style overwrites prior descriptor pointers, while scope teardown reaches <b><i>lv_style_reset</i></b>, which frees only style property storage and leaves both replaced and final arrays unreachable. </pre> <details> <summary><strong>Agent Prompt</strong></summary> ``` ## Issue description Dynamically allocated grid descriptor arrays attached to named XML styles are not owned by the style lifecycle, so they leak both when properties are replaced and when the component scope or style is destroyed. ## Fix Focus Areas - src/others/xml/lv_xml_style.c[61-84] - src/others/xml/lv_xml_style.c[293-317] - src/others/xml/lv_xml_component.c[282-294] - src/misc/lv_style.c[192-201] - src/misc/lv_style.c[327-344] ## Recommended Fix Store XML-owned descriptor pointers in an ownership structure associated with the XML style wrapper. Free the prior descriptor array before replacing a grid property, and release all remaining owned arrays when the component scope or style is destroyed, before resetting the style; do not rely on `lv_style_reset` to free pointer-referenced descriptor data. ``` <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> </details>
PR-level
<h3>PR Summary by Qodo</h3> Expand XML widgets and observer bindings <code>✨ Enhancement</code> <code>🐞 Bug fix</code> <code>📝 Documentation</code> <code>⚙️ Configuration changes</code> <code>🕐 40+ Minutes</code> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <details> <summary>AI Description</summary> <dl> <dd> <br/> ><pre> >• Adds observer bindings for span text and scale section ranges. >• Expands XML support for switches, tab buttons, grid templates, and widget properties. >• Centralizes event-data cleanup and fixes grid, scale, schema, and API documentation issues. ></pre> </dd> </dl> </details> <details> <summary>Diagram</summary> <dl> <dd> <br/> ```mermaid graph TD X["XML Definitions"] --> R["XML Registry"] --> P["Widget Parsers"] --> W["Widget APIs"] --> G["Grid Layout"] S["Data Subjects"] --> O["Observer Bindings"] --> W E["Event Utilities"] --> P E --> O ``` </dd> </dl> </details> <details> <summary>High-Level Assessment</summary> <dl> <dd> <br/> >The following are alternative approaches to this PR: <details> <summary><b>1. Shared grid descriptor parser</b></summary> <dl> <dd> - ➕ Eliminates duplicated tokenization in component-style and object-style parsing. - ➕ Centralizes validation, allocation checks, and fractional-unit handling. - ➕ Makes ownership and cleanup behavior consistent across XML style paths. - ➖ Requires a helper API that communicates descriptor ownership and lifetime. - ➖ Adds a small refactor beyond the immediate feature additions. </dd> </dl> </details> >**Recommendation:** Keep the PR&#x27;s separate widget APIs, observer adapters, and XML parser registrations because they match the existing architecture. However, extract grid descriptor parsing into a shared XML utility before expanding the syntax further; the current duplicated parsing paths risk behavioral and memory-management drift. </dd> </dl> </details> <details> <summary> Files changed (34) <code> +623 / -46 </code> </summary> <dl> <dd> <br/> <details> <summary>Enhancement (17) <code> +523 / -13 </code></summary> <dl> <dd> <details> <summary>lv_event.c<code>Add shared callback data cleanup helper</code> <code>+6/-0</code></summary> <br/> >Add shared callback data cleanup helper > ><pre> >• Implements a reusable event callback that frees the event&#x27;s user data. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-52ff566468d87f6016ee458a4a89dffd561e014d31b1d16af51fd752570dd3af'>src/misc/lv_event.c</a> </details> <details> <summary>lv_event.h<code>Expose event user-data cleanup helper</code> <code>+8/-0</code></summary> <br/> >Expose event user-data cleanup helper > ><pre> >• Declares and documents the shared callback for freeing event-owned user data during deletion. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-72f29d8b0e420df7d686bdd729cb761b9dfa391efc9865f0e323cfbc5234e424'>src/misc/lv_event.h</a> </details> <details> <summary>lv_observer.c<code>Bind subjects to spans and scale sections</code> <code>+145/-6</code></summary> <br/> >Bind subjects to spans and scale sections > ><pre> >• Adds formatted span text observers and integer observers for scale section bounds. Existing subject event helpers now use centralized callback-data cleanup. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-abfb1c3f898e66a830be34f1de694052a7dd3dcc9a582248da69832b8b82be49'>src/others/observer/lv_observer.c</a> </details> <details> <summary>lv_observer.h<code>Declare span and scale observer APIs</code> <code>+40/-0</code></summary> <br/> >Declare span and scale observer APIs > ><pre> >• Adds public APIs and usage contracts for binding subjects to span text and scale section limits. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-3499bd5c299662100fe17500a66fd300853a861d8f63984e35b9541d2eede908'>src/others/observer/lv_observer.h</a> </details> <details> <summary>lv_xml.c<code>Register switch and tab-button XML handlers</code> <code>+3/-0</code></summary> <br/> >Register switch and tab-button XML handlers > ><pre> >• Registers the new switch parser and tabview tab-button child handler with the XML widget registry. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-c84672f2d487a43821417d104c575b21b000c552e7c4288395fbc2cd053a492f'>src/others/xml/lv_xml.c</a> </details> <details> <summary>lv_xml.h<code>Export XML widget declarations</code> <code>+1/-0</code></summary> <br/> >Export XML widget declarations > ><pre> >• Includes the XML widget interface from the main XML public header. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-85539f926a77149fd684a4292aa321981fd7041ed27619104e210555fa5bd854'>src/others/xml/lv_xml.h</a> </details> <details> <summary>lv_xml_style.c<code>Parse grid templates in XML styles</code> <code>+35/-1</code></summary> <br/> >Parse grid templates in XML styles > ><pre> >• Adds parsing of row and column grid descriptor arrays, including fractional units and template terminators, for registered XML styles. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-967f078df35e22e5b6f188f18f80db555d959df428161534ae69f46dc10fdaa2'>src/others/xml/lv_xml_style.c</a> </details> <details> <summary>lv_xml_obj_parser.c<code>Support object grid templates and shared cleanup</code> <code>+37/-6</code></summary> <br/> >Support object grid templates and shared cleanup > ><pre> >• Parses object-level row and column grid descriptor arrays and frees them when the object is deleted. Event callback strings also use centralized cleanup. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-e5c18325eba3e7bf436ff4b2173d43cb2d2d2d58ae3733e997ddb6fefe913ba6'>src/others/xml/parsers/lv_xml_obj_parser.c</a> </details> <details> <summary>lv_xml_spangroup_parser.c<code>Bind XML span text to subjects</code> <code>+20/-0</code></summary> <br/> >Bind XML span text to subjects > ><pre> >• Adds &#x27;bind_text&#x27; and optional format handling for spans declared inside XML spangroups. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-887b0037203cf32d4112fdc56c0175a395d049f7a060bce34e88470b1423c46b'>src/others/xml/parsers/lv_xml_spangroup_parser.c</a> </details> <details> <summary>lv_xml_switch_parser.c<code>Implement XML switch parser</code> <code>+76/-0</code></summary> <br/> >Implement XML switch parser > ><pre> >• Creates switches from XML and maps auto, horizontal, and vertical orientation attributes to widget enums. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-8ad3974ac452c3552c73aae64ba8f676ea1ba3f75d8ff16e989692f4295b824d'>src/others/xml/parsers/lv_xml_switch_parser.c</a> </details> <details> <summary>lv_xml_switch_parser.h<code>Declare XML switch parser interface</code> <code>+40/-0</code></summary> <br/> >Declare XML switch parser interface > ><pre> >• Declares switch creation and attribute-application entry points for XML registration. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-905db47562234b438af8e5d582f82f2acf82e8f617cf1a180d041f1e77d79adf'>src/others/xml/parsers/lv_xml_switch_parser.h</a> </details> <details> <summary>lv_xml_tabview_parser.c<code>Expose tab buttons through XML</code> <code>+27/-0</code></summary> <br/> >Expose tab buttons through XML > ><pre> >• Adds indexed retrieval and common-property application for existing tabview buttons, with empty and out-of-range safeguards. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-c140bb3e6aa4fc454588c099ec852cfb971cb632f39c8e08812fa8b19fdc2abf'>src/others/xml/parsers/lv_xml_tabview_parser.c</a> </details> <details> <summary>lv_xml_tabview_parser.h<code>Declare tab-button XML handlers</code> <code>+2/-0</code></summary> <br/> >Declare tab-button XML handlers > ><pre> >• Adds parser declarations for creating and applying tabview tab-button elements. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-9d8d7fe196eb6719161ae3b1472a0696fd4ebae27ddad655e41f3f96e2b9c0a7'>src/others/xml/parsers/lv_xml_tabview_parser.h</a> </details> <details> <summary>lv_span.c<code>Add formatted span text setters</code> <code>+47/-0</code></summary> <br/> >Add formatted span text setters > ><pre> >• Implements formatted text allocation for individual spans and spangroup-owned spans. The spangroup variant also refreshes the widget. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-b90fea5ae9e8c4205ff9863fb7d1e1d167806bd33b8be6f77f6bd5595f8d5f6a'>src/widgets/span/lv_span.c</a> </details> <details> <summary>lv_span.h<code>Expose formatted span text APIs</code> <code>+20/-0</code></summary> <br/> >Expose formatted span text APIs > ><pre> >• Declares and documents formatted text setters for spans, including explicit spangroup refresh behavior. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-3384e6dbeada6bd4769521f02aedaee5ee5c7dc06ba2b12a0ea5d4dbfd866488'>src/widgets/span/lv_span.h</a> </details> <details> <summary>lv_tabview.c<code>Implement indexed tab-button lookup</code> <code>+7/-0</code></summary> <br/> >Implement indexed tab-button lookup > ><pre> >• Adds lookup of a tabview button by positive or negative child index. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-70b63d9c51775cd49d701a8a5f8a1b42532a0167bee765f194eb7e958317a821'>src/widgets/tabview/lv_tabview.c</a> </details> <details> <summary>lv_tabview.h<code>Expose tab-button lookup API</code> <code>+9/-0</code></summary> <br/> >Expose tab-button lookup API > ><pre> >• Declares and documents indexed access to tabview buttons, including negative indexing. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-0205089573fdb472bcc3fe3ec0413b4089c91e8414b2abc4799b76ed8443c842'>src/widgets/tabview/lv_tabview.h</a> </details> </dd> </dl> </details> <details> <summary>Bug fix (3) <code> +4 / -7 </code></summary> <dl> <dd> <details> <summary>lv_grid.c<code>Abort grid updates when calculation fails</code> <code>+2/-5</code></summary> <br/> >Abort grid updates when calculation fails > ><pre> >• Checks the grid calculation result and stops repositioning items when template calculation fails. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-d4fbcec83262ec1514e184b42a5b299edbf29234dc30fb70ace781ca9b499ad1'>src/layouts/grid/lv_grid.c</a> </details> <details> <summary>lv_bar.xml<code>Correct bar orientation enum name</code> <code>+1/-1</code></summary> <br/> >Correct bar orientation enum name > ><pre> >• Renames the bar orientation enum definition to the expected &#x27;lv_bar_orientation&#x27; identifier. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-190a2cd5f982cd687a2cc2abee160c76feff3ab339a061b38f40ea28c7ab5f17'>xmls/lv_bar.xml</a> </details> <details> <summary>lv_textarea.xml<code>Correct textarea placeholder property</code> <code>+1/-1</code></summary> <br/> >Correct textarea placeholder property > ><pre> >• Renames the textarea XML property from &#x27;placeholder&#x27; to &#x27;placeholder_text&#x27; to match the widget API. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-0969fc7295a0c735cdd27edc1a45c0f062deb582494fa81fa908c17010ff02ef'>xmls/lv_textarea.xml</a> </details> </dd> </dl> </details> <details> <summary>Refactor (2) <code> +4 / -16 </code></summary> <dl> <dd> <details> <summary>lv_obj.c<code>Reuse shared event user-data cleanup</code> <code>+3/-8</code></summary> <br/> >Reuse shared event user-data cleanup > ><pre> >• Replaces the object-local delete callback with the common event user-data cleanup helper for screen and timeline descriptors. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-c19732affe8ccb5cc65e425af59e32011879d0ddf44bcfead38aa9a91720caed'>src/core/lv_obj.c</a> </details> <details> <summary>lv_xml_label_parser.c<code>Centralize label format cleanup</code> <code>+1/-8</code></summary> <br/> >Centralize label format cleanup > ><pre> >• Replaces the label parser&#x27;s private format-string cleanup callback with the shared event helper. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-8054c85c132615f1884f16ebbebc37b313423dfc1432437bba21c079f6d2bead'>src/others/xml/parsers/lv_xml_label_parser.c</a> </details> </dd> </dl> </details> <details> <summary>Documentation (4) <code> +40 / -8 </code></summary> <dl> <dd> <details> <summary>observer.rst<code>Document span and scale observer bindings</code> <code>+29/-1</code></summary> <br/> >Document span and scale observer bindings > ><pre> >• Documents span text binding and one-way scale section minimum and maximum bindings. Updates the supported observer property list accordingly. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-f94c87dac48f53dc41c7fcc8a74bb7048e0bb7fe9c182684e09ca49f1422e0fa'>docs/src/details/auxiliary-modules/observer/observer.rst</a> </details> <details> <summary>lv_obj_tree.h<code>Correct object deletion event documentation</code> <code>+2/-2</code></summary> <br/> >Correct object deletion event documentation > ><pre> >• Corrects the documented deletion event name from &#x27;LV_EVENT_DELETED&#x27; to &#x27;LV_EVENT_DELETE&#x27;. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-eb38e352c0b344d69f5fc8168654e4d9a287a653fa47dbacf8bddaf9fb681282'>src/core/lv_obj_tree.h</a> </details> <details> <summary>lv_text_private.h<code>Normalize formatted-text documentation</code> <code>+1/-1</code></summary> <br/> >Normalize formatted-text documentation > ><pre> >• Capitalizes the formatted-text allocation documentation for consistency. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-0fbef1ee5f5f760972aedcb2cd2a390f501adccdbaf31b3c56fe3146ea99f7e0'>src/misc/lv_text_private.h</a> </details> <details> <summary>lv_label.h<code>Clarify label text shaping behavior</code> <code>+8/-4</code></summary> <br/> >Clarify label text shaping behavior > ><pre> >• Documents how each text setter interacts with Arabic and Persian character processing and corrects argument wording. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-2f200fd00e58aa3dcd61332eae64392269715458389f1ee8d5fa86dacba3e4cd'>src/widgets/label/lv_label.h</a> </details> </dd> </dl> </details> <details> <summary>Other (8) <code> +52 / -2 </code></summary> <dl> <dd> <details> <summary>lv_xml_scale_parser.c<code>Add scale section bindings and fix rotation parsing</code> <code>+19/-1</code></summary> <br/> >Add scale section bindings and fix rotation parsing > ><pre> >• Allows scale section bounds to bind to XML subjects. Rotation is now parsed as an integer rather than a boolean. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-13d076d7c6833fb9e20f3d8802c3e8353bdb8f31a43a468cd5ce84bbbc6ec58f'>src/others/xml/parsers/lv_xml_scale_parser.c</a> </details> <details> <summary>globals.xml<code>Define global grid descriptor properties</code> <code>+3/-0</code></summary> <br/> >Define global grid descriptor properties > ><pre> >• Adds row and column grid descriptor array types to the global property metadata. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-bcee195ccc56523a5730f22865ce0bb61b366b558278e6955714e779d07b2894'>xmls/globals.xml</a> </details> <details> <summary>lv_keyboard.xml<code>Add keyboard number mode metadata</code> <code>+1/-0</code></summary> <br/> >Add keyboard number mode metadata > ><pre> >• Adds the number keyboard mode to the XML keyboard enum definition. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-019193ebd88e679b42b9418a17bc668e90b12e70584aac4bda901f994f9867ea'>xmls/lv_keyboard.xml</a> </details> <details> <summary>lv_obj.xml<code>Fix shadow property and define grid templates</code> <code>+3/-1</code></summary> <br/> >Fix shadow property and define grid templates > ><pre> >• Corrects the shadow width property name and adds object style metadata for grid row and column descriptor arrays. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-d42fadc02322517c9f6adc79fdf6daf4381416a80dd372bfb04e7a34a2314d63'>xmls/lv_obj.xml</a> </details> <details> <summary>lv_scale.xml<code>Define scale section subject bindings</code> <code>+2/-0</code></summary> <br/> >Define scale section subject bindings > ><pre> >• Adds XML metadata for binding subjects to scale section minimum and maximum values. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-332796f05930a6f27dfab7bdf7b9ec62afb2922fedf2cd899de9ead7453577e6'>xmls/lv_scale.xml</a> </details> <details> <summary>lv_spangroup.xml<code>Define span text binding metadata</code> <code>+4/-0</code></summary> <br/> >Define span text binding metadata > ><pre> >• Adds subject and optional format parameters for XML span text binding. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-e9128488665d1d119a7cbaa1d98910b9cb8571d69a446882e3f2fafaaec59b1e'>xmls/lv_spangroup.xml</a> </details> <details> <summary>lv_switch.xml<code>Define XML switch schema</code> <code>+16/-0</code></summary> <br/> >Define XML switch schema > ><pre> >• Introduces switch orientation enum and property metadata for XML tooling. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-1babca1d54e11b70c34da5f6cbf65ba6e30886d825a580ea07ec3916cb609cda'>xmls/lv_switch.xml</a> </details> <details> <summary>lv_tabview.xml<code>Define tab-button child access</code> <code>+4/-0</code></summary> <br/> >Define tab-button child access > ><pre> >• Adds indexed tab-button retrieval as a tabview XML child element. ></pre> > ><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-90a15d1893d96e68dbb771c204b42230a473781d8049816f158cd7243c46aa86'>xmls/lv_tabview.xml</a> </details> </dd> </dl> </details> </dd> </dl> </details>
PR-level
<h3>Code Review by Qodo</h3> <code>🐞 Bugs (14)</code> <code>📘 Rule violations (0)</code> <code>📜 Skill insights (0)</code> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <br/> <img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required"> <details> <summary> 1. Grid descriptors overflow the heap <code>🐞 Bug</code> <code>⛨ Security</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >The two grid descriptor parsers allocate only <b><i>space_count + 1</i></b> entries and then append ><b><i>LV_GRID_TEMPLATE_LAST</i></b> after writing up to <b><i>space_count + 1</i></b> tokens. Every normally formatted >descriptor therefore writes at least its terminator beyond the allocated buffer, which later grid >layout processing reads. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/xml/lv_xml_style.c[293]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-967f078df35e22e5b6f188f18f80db555d959df428161534ae69f46dc10fdaa2R293-R293)</code> > >```diff >+ int32_t * dsc_array = lv_malloc((item_cnt + 1) * sizeof(int32_t)); /*+1 for LV_GRID_TEMPLATE_LAST*/ >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The allocation uses the number of spaces plus one, while parsing writes every token and then writes >a separate terminator; the grid implementation scans these arrays until that terminator. ></pre> > > <code>[src/others/xml/lv_xml_style.c[287-309]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L287-L309)</code> > <code>[src/others/xml/parsers/lv_xml_obj_parser.c[897-920]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/parsers/lv_xml_obj_parser.c/#L897-L920)</code> > <code>[src/others/xml/lv_xml_utils.c[264-289]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_utils.c/#L264-L289)</code> > <code>[src/layouts/grid/lv_grid.c[663-668]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/layouts/grid/lv_grid.c/#L663-L668)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >Both XML grid descriptor parsers allocate space for the parsed tokens but not for the required `LV_GRID_TEMPLATE_LAST` terminator, causing a heap-buffer overflow. > >## Fix Focus Areas >- src/others/xml/lv_xml_style.c[287-309] >- src/others/xml/parsers/lv_xml_obj_parser.c[897-920] > >## Recommended Fix >Count actual tokens and allocate one additional `int32_t` for the terminator in both parsers. Ensure empty or repeated delimiters cannot produce more writes than the allocated capacity. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 2. Grid parsing mutates constant input <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >Both grid descriptor parsers cast each <b><i>const char *value</i></b> to writable storage and pass it to ><b><i>lv_xml_split_str</i></b>, which replaces delimiters with null terminators. Read-only attribute strings can >fault, ordinary parsing mutates parser-owned storage, and named XML constants are permanently >truncated so later uses receive only the first grid item. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/xml/lv_xml_style.c[R295-297]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-967f078df35e22e5b6f188f18f80db555d959df428161534ae69f46dc10fdaa2R295-R297)</code> > >```diff >+ char * value_buf = (char *)value; >+ item_cnt = 0; >+ const char * sub_value = lv_xml_split_str(&value_buf, ' '); >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> ><b><i>lv_xml_split_str</i></b> writes a null terminator at each delimiter even though both grid descriptor >callers receive <b><i>const char *</i></b> values from XML creation and parser APIs. Style constant resolution >passes the retained constant value directly to the parser, proving that the destructive mutation >persists beyond the current property application and affects later uses. ></pre> > > <code>[src/others/xml/lv_xml_style.c[295-308]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L295-L308)</code> > <code>[src/others/xml/parsers/lv_xml_obj_parser.c[905-918]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/parsers/lv_xml_obj_parser.c/#L905-L918)</code> > <code>[src/others/xml/lv_xml_utils.c[264-273]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_utils.c/#L264-L273)</code> > <code>[src/others/xml/lv_xml.c[252-252]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml.c/#L252-L252)</code> > <code>[src/others/xml/lv_xml_utils.c[264-274]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_utils.c/#L264-L274)</code> > <code>[src/others/xml/lv_xml_style.c[85-113]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L85-L113)</code> > <code>[src/others/xml/lv_xml.c[473-492]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml.c/#L473-L492)</code> > <code>[src/others/xml/lv_xml.c[742-757]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml.c/#L742-L757)</code> > <code>[src/others/xml/parsers/lv_xml_obj_parser.c[904-920]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/parsers/lv_xml_obj_parser.c/#L904-L920)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The grid descriptor parsers cast away the attribute API's const qualifier and use a destructive tokenizer on potentially read-only or shared storage, which can corrupt retained XML constant values after their first use. > >## Fix Focus Areas >- src/others/xml/lv_xml_style.c[294-309] >- src/others/xml/parsers/lv_xml_obj_parser.c[904-920] >- src/others/xml/lv_xml_utils.c[264-274] > >## Recommended Fix >Duplicate the descriptor `value` into temporary writable allocated storage before calling `lv_xml_split_str`, construct the integer descriptor array from that copy, and free the temporary buffer on every success and failure path in both the style and object parsing paths. Leave the source attribute or constant unchanged; alternatively, replace the destructive split with non-destructive token scanning over the const input. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 3. Named grid styles remain unsupported <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>lv_xml_style_register</i></b> compares named-style attributes against <b><i>style_grid_column_dsc_array</i></b> and ><b><i>style_grid_row_dsc_array</i></b>, even though named styles receive the unprefixed property names ><b><i>grid_column_dsc_array</i></b> and <b><i>grid_row_dsc_array</i></b>. Valid grid template attributes on XML <b><i>&lt;style&gt;</i></b> >elements therefore fall through as unsupported and never configure or affect the layout. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/xml/lv_xml_style.c[R284-285]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-967f078df35e22e5b6f188f18f80db555d959df428161534ae69f46dc10fdaa2R284-R285)</code> > >```diff >+ else if(lv_streq(name, "style_grid_column_dsc_array") || >+ lv_streq(name, "style_grid_row_dsc_array")) { >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The existing named-style parser compares attributes using unprefixed names such as <b><i>width</i></b> and ><b><i>bg_color</i></b>, and the global XML style schema likewise declares the new properties as ><b><i>grid_column_dsc_array</i></b> and <b><i>grid_row_dsc_array</i></b>. The added branch instead checks the ><b><i>style_</i></b>-prefixed object-property spellings, demonstrating why schema-valid named-style attributes >cannot reach it. ></pre> > > <code>[src/others/xml/lv_xml_style.c[85-89]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L85-L89)</code> > <code>[src/others/xml/lv_xml_style.c[133-151]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L133-L151)</code> > <code>[src/others/xml/lv_xml_style.c[284-316]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L284-L316)</code> > <code>[xmls/globals.xml[314-316]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/xmls/globals.xml/#L314-L316)</code> > <code>[src/others/xml/lv_xml_style.c[41-46]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L41-L46)</code> > <code>[src/others/xml/lv_xml_style.c[270-285]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L270-L285)</code> > <code>[xmls/globals.xml[315-316]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/xmls/globals.xml/#L315-L316)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >Named XML styles use the unprefixed properties `grid_column_dsc_array` and `grid_row_dsc_array`, but the new parser branch expects object-property names with a `style_` prefix, so valid grid descriptor attributes on XML style definitions are not recognized. > >## Fix Focus Areas >- src/others/xml/lv_xml_style.c[284-317] >- xmls/globals.xml[314-316] > >## Recommended Fix >Update `lv_xml_style_register` to match `grid_column_dsc_array` and `grid_row_dsc_array`, consistent with the style-definition schema and the parser's other unprefixed style properties. Retain the `style_`-prefixed names only in the object-property parser, where object attributes use them. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details><summary><ins><strong>View high (3)</strong></ins></summary><br/> <details> <summary> 4. Deleted spans remain observable <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>lv_spangroup_bind_span_text</i></b> stores a raw, separately deletable span pointer in observer data while >tying observer cleanup only to the containing spangroup. If that span is deleted while the spangroup >remains alive, subsequent subject notifications reuse the freed pointer and pass it to the span text >setter. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/observer/lv_observer.c[R831-835]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-abfb1c3f898e66a830be34f1de694052a7dd3dcc9a582248da69832b8b82be49R831-R835)</code> > >```diff >+ user_data->subject = subject; >+ user_data->element = span; >+ user_data->fmt = fmt; >+ >+ lv_observer_t * observer = lv_subject_add_observer_obj(subject, span_text_observer_cb, obj, user_data); >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The binding targets the spangroup but retains the individual span pointer in its user data, and the >callback uses that pointer on every notification without validating it. Individual span deletion >removes the span from the list and frees it without removing these observers, because object-target >observers are cleaned up only when the spangroup receives its delete event. ></pre> > > <code>[src/others/observer/lv_observer.c[831-836]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L831-L836)</code> > <code>[src/others/observer/lv_observer.c[458-461]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L458-L461)</code> > <code>[src/widgets/span/lv_span.c[113-130]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L113-L130)</code> > <code>[src/others/observer/lv_observer.c[1190-1211]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L1190-L1211)</code> > <code>[src/widgets/span/lv_span.c[137-153]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L137-L153)</code> > <code>[src/others/observer/lv_observer.c[433-462]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L433-L462)</code> > <code>[src/others/observer/lv_observer.c[1190-1216]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L1190-L1216)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >Span text observers can outlive individually deleted spans because observer cleanup is associated only with the containing spangroup. A later subject notification can therefore pass a freed span pointer to the span text setter. > >## Fix Focus Areas >- src/others/observer/lv_observer.c[827-838] >- src/others/observer/lv_observer.c[1190-1216] >- src/widgets/span/lv_span.c[113-130] >- src/widgets/span/lv_span.c[137-153] > >## Recommended Fix >Associate each span-text binding with the lifetime of its span and remove the corresponding observer before `lv_spangroup_delete_span` frees that span. This may require tracking bound observers on each span or adding a span-deletion cleanup hook; alternatively, make the binding callback verify that the span is still owned by the target spangroup before using it. Ensure that the observer's auto-freed binding data is released when the observer is removed. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 5. Span configurations fail to link <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >The new span-binding declaration is guarded by <b><i>LV_USE_LABEL</i></b>, while its implementation and XML >caller are guarded by <b><i>LV_USE_SPAN</i></b>. With spans and XML enabled but labels disabled, the caller >compiles without a declaration; with labels enabled but spans disabled, the header exposes a >function whose implementation is not compiled. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/observer/lv_observer.h[R548-550]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-3499bd5c299662100fe17500a66fd300853a861d8f63984e35b9541d2eede908R548-R550)</code> > >```diff >+#if LV_USE_LABEL >+ >+/** >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >Labels and spans are independently configurable, but the header places the declaration under ><b><i>LV_USE_LABEL</i></b> while the implementation and callback use <b><i>LV_USE_SPAN</i></b>. The XML span parser includes >the observer header and compiles its span-binding call when span support is enabled, proving that a >valid span-only configuration omits the required declaration. ></pre> > > <code>[src/others/observer/lv_observer.h[548-564]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.h/#L548-L564)</code> > <code>[src/others/observer/lv_observer.c[795-840]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L795-L840)</code> > <code>[src/others/observer/lv_observer.c[1188-1218]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L1188-L1218)</code> > <code>[src/others/xml/lv_xml.h[18-24]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml.h/#L18-L24)</code> > <code>[src/others/xml/parsers/lv_xml_spangroup_parser.c[91-103]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/parsers/lv_xml_spangroup_parser.c/#L91-L103)</code> > <code>[src/lv_conf_internal.h[2320-2328]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/lv_conf_internal.h/#L2320-L2328)</code> > <code>[src/lv_conf_internal.h[2467-2475]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/lv_conf_internal.h/#L2467-L2475)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The public span observer API declaration is conditionally guarded by the unrelated label feature flag, even though spans are independently configurable and the XML span parser calls the API when span support is enabled. > >## Fix Focus Areas >- src/others/observer/lv_observer.h[548-564] >- src/others/observer/lv_observer.c[795-840] >- src/others/xml/parsers/lv_xml_spangroup_parser.c[91-103] > >## Recommended Fix >Change the declaration's feature guard from `LV_USE_LABEL` to `LV_USE_SPAN` so the declaration, implementation, callback, and callers are compiled under the same configuration. Keep the API unavailable only when span support itself is disabled. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 6. CMSIS XML builds fail linking <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>lv_xml_init</i></b> now references the switch parser functions, but the CMSIS-Pack manifest does not >include the new parser source file. Enabling the packaged XML component therefore compiles the >registration call without either function definition and fails at link time. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/xml/lv_xml.c[118]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-c84672f2d487a43821417d104c575b21b000c552e7c4288395fbc2cd053a492fR118-R118)</code> > >```diff >+ lv_xml_widget_register("lv_switch", lv_xml_switch_create, lv_xml_switch_apply); >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The registration creates references to both switch parser functions, while the XML component&#x27;s >exhaustive parser source list contains neighboring parsers but omits the newly added file. ></pre> > > <code>[src/others/xml/lv_xml.c[115-119]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml.c/#L115-L119)</code> > <code>[env_support/cmsis-pack/LVGL.lvgl.pdsc[1766-1790]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/env_support/cmsis-pack/LVGL.lvgl.pdsc/#L1766-L1790)</code> > <code>[src/others/xml/parsers/lv_xml_switch_parser.c[40-59]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/parsers/lv_xml_switch_parser.c/#L40-L59)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The explicit CMSIS-Pack XML source manifest omits the newly registered switch parser implementation. > >## Fix Focus Areas >- src/others/xml/lv_xml.c[115-119] >- env_support/cmsis-pack/LVGL.lvgl.pdsc[1766-1790] > >## Recommended Fix >Add `src/others/xml/parsers/lv_xml_switch_parser.c` to the XML parser file list in `LVGL.lvgl.pdsc`, alongside the other widget parser sources. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> </details> <br/> <img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended"> <details> <summary> 7. Binding allocation failure crashes <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>lv_spangroup_bind_span_text</i></b> unconditionally dereferences the nullable result of ><b><i>lv_subject_add_observer_obj</i></b> after allocating its binding user data. If observer-node allocation >fails, <b><i>observer</i></b> is <b><i>NULL</i></b>, and the binding data remains unreleased because automatic user-data >cleanup only applies to a successfully created observer. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/observer/lv_observer.c[R835-836]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-abfb1c3f898e66a830be34f1de694052a7dd3dcc9a582248da69832b8b82be49R835-R836)</code> > >```diff >+ lv_observer_t * observer = lv_subject_add_observer_obj(subject, span_text_observer_cb, obj, user_data); >+ observer->auto_free_user_data = 1; >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The observer insertion routine explicitly returns <b><i>NULL</i></b> when list insertion or allocation fails, >while the span binding immediately accesses a member through that unchecked return value. The cited >cleanup path also shows that automatic user-data freeing occurs only when a successfully created >observer is removed, so the binding allocation leaks on registration failure. ></pre> > > <code>[src/others/observer/lv_observer.c[824-838]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L824-L838)</code> > <code>[src/others/observer/lv_observer.c[443-451]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L443-L451)</code> > <code>[src/others/observer/lv_observer.c[496-505]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L496-L505)</code> > <code>[src/others/observer/lv_observer.c[429-455]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L429-L455)</code> > <code>[src/others/observer/lv_observer.c[503-506]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L503-L506)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The span binding assumes observer registration always succeeds and dereferences a nullable result, leaking its newly allocated user data when registration fails. > >## Fix Focus Areas >- src/others/observer/lv_observer.c[824-838] >- src/others/observer/lv_observer.c[429-451] > >## Recommended Fix >Check whether `lv_subject_add_observer_obj` returned `NULL` before accessing `observer`. On failure, free the newly allocated `user_data` and return `NULL`; set `auto_free_user_data` only after registration succeeds. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 8. Missing tab index crashes parsing <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>lv_xml_tabview_tab_button_create</i></b> passes the nullable result of `lv_xml_get_value_of(attrs, >&quot;index&quot;)<b><i> directly to </i></b>lv_xml_atoi`. An XML tab-button element missing that attribute therefore >dereferences <b><i>NULL</i></b> instead of being rejected or receiving a default. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/xml/parsers/lv_xml_tabview_parser.c[R99-100]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-c140bb3e6aa4fc454588c099ec852cfb971cb632f39c8e08812fa8b19fdc2abfR99-R100)</code> > >```diff >+ const char * index_str = lv_xml_get_value_of(attrs, "index"); >+ int32_t index_int = lv_xml_atoi(index_str); >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >Attribute lookup returns null when absent, and the integer parser dereferences its input while >skipping whitespace. ></pre> > > <code>[src/others/xml/parsers/lv_xml_tabview_parser.c[99-106]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/parsers/lv_xml_tabview_parser.c/#L99-L106)</code> > <code>[src/others/xml/lv_xml_utils.c[31-39]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_utils.c/#L31-L39)</code> > <code>[src/others/xml/lv_xml_utils.c[82-88]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_utils.c/#L82-L88)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The tab-button XML parser converts a missing `index` attribute without checking for null. > >## Fix Focus Areas >- src/others/xml/parsers/lv_xml_tabview_parser.c[99-106] > >## Recommended Fix >Check `index_str` before conversion. Log a clear warning and return `NULL`, or explicitly default to index zero, consistently with the XML API contract. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 9. Valid reverse tab indexes reset <code>🐞 Bug</code> <code>≡ Correctness</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >The tab-button parser rejects <b><i>LV_ABS(index_int) &gt;= btn_cnt</i></b>, although the underlying child lookup >accepts <b><i>-btn_cnt</i></b> as the first button. This makes <b><i>-1</i></b> invalid for a one-tab view and silently >selects the first tab for otherwise valid reverse indexes at the lower boundary. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/xml/parsers/lv_xml_tabview_parser.c[R101-104]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-c140bb3e6aa4fc454588c099ec852cfb971cb632f39c8e08812fa8b19fdc2abfR101-R104)</code> > >```diff >+ if(LV_ABS(index_int) >= btn_cnt) { >+ LV_LOG_WARN("tabindex is out of range, using the first tab instead"); >+ index_int = 0; >+ } >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The public API documents negative indexing, and the underlying child traversal accepts <b><i>-btn_cnt</i></b>, >but the new XML check rejects equality at that boundary. ></pre> > > <code>[src/others/xml/parsers/lv_xml_tabview_parser.c[101-106]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/parsers/lv_xml_tabview_parser.c/#L101-L106)</code> > <code>[src/widgets/tabview/lv_tabview.h[91-98]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/tabview/lv_tabview.h/#L91-L98)</code> > <code>[src/widgets/tabview/lv_tabview.c[245-250]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/tabview/lv_tabview.c/#L245-L250)</code> > <code>[src/core/lv_obj_tree.c[355-382]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/core/lv_obj_tree.c/#L355-L382)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The tab-button XML range check rejects the documented negative index that addresses the first child from the back. > >## Fix Focus Areas >- src/others/xml/parsers/lv_xml_tabview_parser.c[101-106] >- src/widgets/tabview/lv_tabview.h[91-98] > >## Recommended Fix >Validate positive and negative ranges separately: accept `0` through `btn_cnt - 1` and `-1` through `-btn_cnt`. Avoid `LV_ABS` so the check also remains safe for the minimum integer value. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details><summary><ins><strong>View medium (5)</strong></ins></summary><br/> <details> <summary> 10. Formatting failure skips cleanup <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >Both new variadic span setters return after a formatting allocation failure without calling ><b><i>va_end(args)</i></b>. Platforms where variadic traversal requires cleanup therefore encounter undefined >behavior specifically on the new out-of-memory path. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/widgets/span/lv_span.c[R208-212]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-b90fea5ae9e8c4205ff9863fb7d1e1d167806bd33b8be6f77f6bd5595f8d5f6aR208-R212)</code> > >```diff >+ va_list args; >+ va_start(args, fmt); >+ char * text = lv_text_set_text_vfmt(fmt, args); >+ LV_ASSERT_MALLOC(text); >+ if(text == NULL) return; >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >Each function calls <b><i>va_start</i></b>, then returns on a null formatted string before reaching its later ><b><i>va_end</i></b>. ></pre> > > <code>[src/widgets/span/lv_span.c[208-215]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L208-L215)</code> > <code>[src/widgets/span/lv_span.c[266-273]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L266-L273)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The new formatted span setters bypass `va_end` when text allocation fails. > >## Fix Focus Areas >- src/widgets/span/lv_span.c[208-215] >- src/widgets/span/lv_span.c[266-273] > >## Recommended Fix >Call `va_end(args)` immediately after `lv_text_set_text_vfmt` and before testing the returned allocation, or use a shared cleanup path in both functions. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 11. Null scale sections crash binding <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >The new scale-section bind functions validate the subject and scale but not the section pointer, >then invoke their observer callback immediately during registration. A failed section allocation or >direct null argument therefore reaches the section setter with <b><i>NULL</i></b> and dereferences it. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/observer/lv_observer.c[R919-921]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-abfb1c3f898e66a830be34f1de694052a7dd3dcc9a582248da69832b8b82be49R919-R921)</code> > >```diff >+ LV_ASSERT_NULL(subject); >+ LV_ASSERT_NULL(obj); >+ >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >Observer registration invokes the callback immediately, while the callback forwards the unchecked >pointer to setters that access section fields; section creation can return null on allocation >failure. ></pre> > > <code>[src/others/observer/lv_observer.c[917-944]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L917-L944)</code> > <code>[src/others/observer/lv_observer.c[434-463]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L434-L463)</code> > <code>[src/others/observer/lv_observer.c[1321-1330]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L1321-L1330)</code> > <code>[src/widgets/scale/lv_scale.c[356-363]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/scale/lv_scale.c/#L356-L363)</code> > <code>[src/widgets/scale/lv_scale.c[386-402]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/scale/lv_scale.c/#L386-L402)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The new scale-section observer APIs accept a null section even though registration immediately invokes a callback that requires a valid section. > >## Fix Focus Areas >- src/others/observer/lv_observer.c[917-929] >- src/others/observer/lv_observer.c[932-944] >- src/others/xml/parsers/lv_xml_scale_parser.c[108-125] > >## Recommended Fix >Assert and runtime-check `section` in both public bind functions before registering the observer. Ensure the XML section creation path does not apply attributes when section allocation failed. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 12. Formatted span updates leak text <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >Both formatted span setters replace <b><i>span-&gt;txt</i></b> but free it only when `span-&gt;txt == NULL &amp;&amp; >span-&gt;static_flag`, a condition that excludes existing dynamically owned buffers. Every subsequent >successful formatted update through either setter abandons the previous rendered allocation. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/widgets/span/lv_span.c[R216-220]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-b90fea5ae9e8c4205ff9863fb7d1e1d167806bd33b8be6f77f6bd5595f8d5f6aR216-R220)</code> > >```diff >+ if(span->txt == NULL && span->static_flag) { >+ lv_free(span->txt); >+ } >+ >+ span->static_flag = 0; >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The formatting helper returns newly allocated text, while the established ownership model identifies >dynamic span text with <b><i>static_flag == 0</i></b> and frees it on replacement or deletion. In both formatted >APIs, <b><i>lv_free</i></b> is instead guarded by a null pointer and static flag before <b><i>span-&gt;txt</i></b> is >overwritten, so the old dynamic allocation cannot be released. ></pre> > > <code>[src/misc/lv_text.c[484-525]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/misc/lv_text.c/#L484-L525)</code> > <code>[src/widgets/span/lv_span.c[140-153]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L140-L153)</code> > <code>[src/widgets/span/lv_span.c[168-200]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L168-L200)</code> > <code>[src/widgets/span/lv_span.c[274-280]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L274-L280)</code> > <code>[src/widgets/span/lv_span.c[120-128]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L120-L128)</code> > <code>[src/widgets/span/lv_span.c[202-222]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L202-L222)</code> > <code>[src/widgets/span/lv_span.c[260-282]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/widgets/span/lv_span.c/#L260-L282)</code> > <code>[src/others/observer/lv_observer.c[1200-1206]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/observer/lv_observer.c/#L1200-L1206)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The formatted span setters use an inverted ownership condition and overwrite dynamically owned span text without freeing it, leaking one allocation for each successful formatted update after the first. > >## Fix Focus Areas >- src/widgets/span/lv_span.c[202-222] >- src/widgets/span/lv_span.c[260-282] > >## Recommended Fix >Before assigning the newly formatted buffer, free the old value when `span->txt != NULL` and `span->static_flag == 0`. Apply the same ownership transition in both formatted setters, and do not free static text. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 13. Grid parsing crashes under memory pressure <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> >Both new grid descriptor parsers write parsed values and the terminator through <b><i>dsc_array</i></b> >immediately after <b><i>lv_malloc</i></b> without checking whether it returned <b><i>NULL</i></b>. Under memory pressure, >allocation failure in either XML style or object processing reaches the first indexed write and >dereferences the null pointer. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/xml/lv_xml_style.c[R293-296]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-967f078df35e22e5b6f188f18f80db555d959df428161534ae69f46dc10fdaa2R293-R296)</code> > >```diff >+ int32_t * dsc_array = lv_malloc((item_cnt + 1) * sizeof(int32_t)); /*+1 for LV_GRID_TEMPLATE_LAST*/ >+ >+ char * value_buf = (char *)value; >+ item_cnt = 0; >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The repository allocator can return <b><i>NULL</i></b>, but neither parser tests the allocation result before >entering the loop that stores parsed values or writing the terminator; both the style and object >parser contain the same unchecked sequence. ></pre> > > <code>[src/others/xml/lv_xml_style.c[293-309]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L293-L309)</code> > <code>[src/others/xml/parsers/lv_xml_obj_parser.c[903-920]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/parsers/lv_xml_obj_parser.c/#L903-L920)</code> > <code>[src/stdlib/lv_mem.c[62-84]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/stdlib/lv_mem.c/#L62-L84)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >The new XML grid descriptor parsers do not handle descriptor allocation failure before writing parsed values or the terminator through the returned pointer. > >## Fix Focus Areas >- src/others/xml/lv_xml_style.c[293-309] >- src/others/xml/parsers/lv_xml_obj_parser.c[903-920] > >## Recommended Fix >Check `dsc_array` immediately after each `lv_malloc`, before parsing values or writing the terminator. If it is `NULL`, log or assert according to the project's allocation-failure convention, then return an invalid result or skip applying the property/descriptor without modifying the style; apply the same handling in both parsers. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> <details> <summary> 14. Style grid arrays are never freed <code>🐞 Bug</code> <code>☼ Reliability</code></summary> <br/> > <details open> ><summary>Description</summary> ><br/> > ><pre> ><b><i>lv_xml_style_register</i></b> allocates grid descriptor arrays and stores their raw pointers in an ><b><i>lv_style_t</i></b> without registering ownership or cleanup. Re-registering or extending a same-named >style overwrites prior descriptor pointers, while scope teardown reaches <b><i>lv_style_reset</i></b>, which >frees only style property storage and leaves both replaced and final arrays unreachable. ></pre> ></details> > <details> ><summary>Code</summary> ><br/> > ><code>[src/others/xml/lv_xml_style.c[R293-317]](https://github.com/drape-io/crbench-qodo-2026-09/pull/106/files#diff-967f078df35e22e5b6f188f18f80db555d959df428161534ae69f46dc10fdaa2R293-R317)</code> > >```diff >+ int32_t * dsc_array = lv_malloc((item_cnt + 1) * sizeof(int32_t)); /*+1 for LV_GRID_TEMPLATE_LAST*/ >+ >+ char * value_buf = (char *)value; >+ item_cnt = 0; >+ const char * sub_value = lv_xml_split_str(&value_buf, ' '); >+ while(sub_value) { >+ if(sub_value[0] == 'f' && sub_value[1] == 'r') { >+ dsc_array[item_cnt] = LV_GRID_FR(lv_xml_atoi(sub_value + 3)); /*+3 to skip "fr("*/ >+ } >+ else { >+ dsc_array[item_cnt] = lv_xml_atoi(sub_value); >+ } >+ >+ item_cnt++; >+ sub_value = lv_xml_split_str(&value_buf, ' '); >+ } >+ dsc_array[item_cnt] = LV_GRID_TEMPLATE_LAST; >+ >+ if(lv_streq(name, "style_grid_column_dsc_array")) { >+ lv_style_set_grid_column_dsc_array(style, dsc_array); >+ } >+ else { >+ lv_style_set_grid_row_dsc_array(style, dsc_array); >+ } >+ } >``` ></details> > <details> ><summary>Evidence</summary> ><br/> > ><pre> >The XML style registry deliberately reuses same-named styles, and style setters retain only the raw >descriptor pointers, so updating a grid property overwrites the previous pointer without releasing >its allocation. During XML component scope teardown, <b><i>lv_style_reset</i></b> releases the style’s property >array but not the externally allocated data referenced by pointer-valued properties, proving that >neither replaced nor currently attached descriptor arrays have a cleanup path. ></pre> > > <code>[src/others/xml/lv_xml_style.c[61-84]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L61-L84)</code> > <code>[src/misc/lv_style.c[192-201]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/misc/lv_style.c/#L192-L201)</code> > <code>[src/misc/lv_style.c[327-344]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/misc/lv_style.c/#L327-L344)</code> > <code>[src/misc/lv_style_gen.c[881-886]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/misc/lv_style_gen.c/#L881-L886)</code> > <code>[src/others/xml/lv_xml_style.c[293-316]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_style.c/#L293-L316)</code> > <code>[src/misc/lv_style_gen.c[881-904]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/misc/lv_style_gen.c/#L881-L904)</code> > <code>[src/others/xml/lv_xml_component.c[282-294]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/others/xml/lv_xml_component.c/#L282-L294)</code> > <code>[src/misc/lv_style.c[192-200]](https://github.com/drape-io/crbench-qodo-2026-09/blob/d702041e13011c026a8ad44f2c3e3f2b626d7c50/src/misc/lv_style.c/#L192-L200)</code> ></details> > <details> ><summary>Agent prompt</summary> ><br/> > >``` >The issue below was found during a code review. Follow the provided context and guidance below and implement a solution > >## Issue description >Dynamically allocated grid descriptor arrays attached to named XML styles are not owned by the style lifecycle, so they leak both when properties are replaced and when the component scope or style is destroyed. > >## Fix Focus Areas >- src/others/xml/lv_xml_style.c[61-84] >- src/others/xml/lv_xml_style.c[293-317] >- src/others/xml/lv_xml_component.c[282-294] >- src/misc/lv_style.c[192-201] >- src/misc/lv_style.c[327-344] > >## Recommended Fix >Store XML-owned descriptor pointers in an ownership structure associated with the XML style wrapper. Free the prior descriptor array before replacing a grid property, and release all remaining owned arrays when the component scope or style is destroyed, before resetting the style; do not rely on `lv_style_reset` to free pointer-referenced descriptor data. >``` > <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code> ></details> <hr/> </details> </details> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <!-- qodo-context:start --> <details><summary><strong>Context sources</strong></summary> <div>Review mode: <code>🧠 Deep</code>: This is a bug-dense, cross-cutting runtime/API change spanning observer bindings, XML parsing, widgets, grid styles, memory ownership, and multiple independent code paths.</div> <!-- qodo-context:end --> </details> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <!-- qodo-daily-tip:start --> <details> <summary><strong>Tip of the day</strong></summary> <br/> <pre>💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR</pre> <a href="https://docs.qodo.ai/tips-and-tricks">More tips ↗</a> | <a href="https://app.qodo.ai/configurations?tab=display-preferences">Customize Qodo ↗</a> | <a href="https://docs.qodo.ai">Qodo docs ↗</a> </details> <img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider"> <!-- qodo-daily-tip:end --> <!-- https://github.com/drape-io/crbench-qodo-2026-09/commit/d702041e13011c026a8ad44f2c3e3f2b626d7c50 --> <a href="https://www.qodo.ai"><img src="https://www.qodo.ai/wp-content/uploads/2025/03/qodo-logo.svg" width="80" alt="Qodo Logo"></a>