Skip to content

feat(core): add lv_check_arg to public functions in lv_observer#10203

Open
axos88 wants to merge 3 commits into
masterfrom
feat-add-lv-check-arg-to-core-lv_observer
Open

feat(core): add lv_check_arg to public functions in lv_observer#10203
axos88 wants to merge 3 commits into
masterfrom
feat-add-lv-check-arg-to-core-lv_observer

Conversation

@axos88
Copy link
Copy Markdown
Contributor

@axos88 axos88 commented May 28, 2026

Summary

Add LV_CHECK_ARG guards to previously unguarded parameters in public API functions in src/core/lv_observer.c. This PR adds parameter validation to 7 functions and fixes 1 validation issue.

Functions modified

Function Parameter Action Reason
void lv_subject_init_int(lv_subject_t * subject, int32_t value) subject Added Dereferenced directly
value No check needed Integer, any value valid
void lv_subject_init_string(lv_subject_t * subject, char * buf, char * tmp_buf, uint32_t size, const char * value) subject Added Dereferenced directly
buf Added Passed to lv_strlcpy directly
size Added size == 0 makes subject permanently unusable
value Added Passed to lv_strlcpy directly

Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 19:35
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Hi 👋, thank you for your PR!

We've run benchmarks in an emulated environment. Here are the results:

ARM Emulated 32b - lv_conf_perf32b

Scene Name Avg CPU (%) Avg FPS Avg Time (ms) Render Time (ms) Flush Time (ms)
All scenes avg. 36 35 10 10 0
Detailed Results Per Scene
Scene Name Avg CPU (%) Avg FPS Avg Time (ms) Render Time (ms) Flush Time (ms)
Empty screen 11 33 0 0 0
Moving wallpaper 5 33 1 1 0
Single rectangle 0 50 0 0 0
Multiple rectangles 0 33 0 0 0
Multiple RGB images 0 38 0 0 0
Multiple ARGB images 22 33 7 7 0
Rotated ARGB images 61 46 16 16 0
Multiple labels 40 (+3) 34 (+1) 10 10 0
Screen sized text 86 (-3) 46 18 18 0
Multiple arcs 44 36 9 9 0
Containers 10 (+2) 38 (+1) 0 0 0
Containers with overlay 88 20 46 46 0
Containers with opa 23 (-2) 38 (+1) 2 2 0
Containers with opa_layer 25 (+3) 36 7 (+1) 7 (+1) 0
Containers with scrolling 98 36 24 24 0
Widgets demo 74 (-2) 20 22 (-1) 22 (-1) 0
All scenes avg. 36 35 10 10 0

ARM Emulated 64b - lv_conf_perf64b

Scene Name Avg CPU (%) Avg FPS Avg Time (ms) Render Time (ms) Flush Time (ms)
All scenes avg. 35 (+1) 35 9 9 0
Detailed Results Per Scene
Scene Name Avg CPU (%) Avg FPS Avg Time (ms) Render Time (ms) Flush Time (ms)
Empty screen 11 33 0 0 0
Moving wallpaper 2 33 1 1 0
Single rectangle 0 50 0 0 0
Multiple rectangles 0 33 0 0 0
Multiple RGB images 0 35 0 0 0
Multiple ARGB images 20 33 7 7 0
Rotated ARGB images 30 33 9 9 0
Multiple labels 60 46 10 10 0
Screen sized text 87 46 18 18 0
Multiple arcs 49 40 7 7 0
Containers 7 38 (-1) 0 0 0
Containers with overlay 90 21 43 43 0
Containers with opa 19 (+12) 37 (+1) 1 1 0
Containers with opa_layer 23 35 (-2) 7 7 0
Containers with scrolling 97 (-1) 38 23 (+1) 23 (+1) 0
Widgets demo 74 22 20 20 0
All scenes avg. 35 (+1) 35 9 9 0

Disclaimer: These benchmarks were run in an emulated environment using QEMU with instruction counting mode.
The timing values represent relative performance metrics within this specific virtualized setup and should
not be interpreted as absolute real-world performance measurements. Values are deterministic and useful for
comparing different LVGL features and configurations, but may not correlate directly with performance on
physical hardware. The measurements are intended for comparative analysis only.


🤖 This comment was automatically generated by a bot.

@axos88 axos88 marked this pull request as draft May 29, 2026 10:04
@axos88 axos88 marked this pull request as ready for review June 3, 2026 09:37
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

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/core/lv_observer.c">

<violation number="1" location="src/core/lv_observer.c:512">
P2: Allowing `subject == NULL` here opens a path where `lv_obj_remove_event_cb_with_user_data(obj, NULL, subject)` becomes `...user_data == NULL`, which can remove unrelated callbacks from the widget.

(Based on your team's feedback about documented NULL semantics for `lv_obj_remove_from_subject`.) [FEEDBACK_USED]</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/core/lv_observer.c
{
LV_CHECK_ARG(obj != NULL, return);
LV_CHECK_ARG(subject != NULL, return);
/* subject == NULL is documented as valid: remove from ALL subjects */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Allowing subject == NULL here opens a path where lv_obj_remove_event_cb_with_user_data(obj, NULL, subject) becomes ...user_data == NULL, which can remove unrelated callbacks from the widget.

(Based on your team's feedback about documented NULL semantics for lv_obj_remove_from_subject.)

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/core/lv_observer.c, line 512:

<comment>Allowing `subject == NULL` here opens a path where `lv_obj_remove_event_cb_with_user_data(obj, NULL, subject)` becomes `...user_data == NULL`, which can remove unrelated callbacks from the widget.

(Based on your team's feedback about documented NULL semantics for `lv_obj_remove_from_subject`.) </comment>

<file context>
@@ -502,7 +509,8 @@ void lv_observer_remove(lv_observer_t * observer)
 {
     LV_CHECK_ARG(obj != NULL, return);
-    LV_CHECK_ARG(subject != NULL, return);
+    /* subject == NULL is documented as valid: remove from ALL subjects */
+
     /*
</file context>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants