Skip to content

Fix warnings#29

Open
ewowi wants to merge 4 commits intohpwit:vjson2from
ewowi:fix-warnings
Open

Fix warnings#29
ewowi wants to merge 4 commits intohpwit:vjson2from
ewowi:fix-warnings

Conversation

@ewowi
Copy link
Copy Markdown
Collaborator

@ewowi ewowi commented Nov 2, 2025

findtext: const char *
heap_caps_free instead of heap_caps_aligned_free
const char * _div[]
add return to _rand
displayStat: const char *

ewowi added 2 commits November 2, 2025 21:51
findtext: const char *
heap_caps_free instead of heap_caps_aligned_free
const char * _div[]
add return to _rand
displayStat: const char *
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 48846c5d-1490-4ac8-a640-ada0a7d9dc7c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

ewowi added 2 commits March 28, 2026 20:51
getChildAtPos returns NULL when out of bounds — that's the confirmed null. The fix belongs in findMaxArgumentSize() in NodeToken.h.

  Root cause: when an addExternal-registered function (like random16) is used as a nested argument expression (not a statement), ESPLiveScript builds its AST node without children 1 and 2. findMaxArgumentSize()
  enters the extCallFunctionNode branch and immediately dereferences getChildAtPos(1) without a null check → crash.

  The fix — add null guards before the two dereferences in findMaxArgumentSize():

Why returning cur_size (0) is semantically correct: findMaxArgumentSize() tells _visitCallFunctionTemplate whether an argument needs stack-spilling before the outer call. The check is findMaxArgumentSize() - 1
  >= i — for a scalar like uint16_t from random16, the correct answer is 0 (fits in one register, no spill). Arithmetic expressions like y*width+x also return 0 via the else branch. The early-return preserves that
   behaviour for nested extern scalars.

  PR description for the ESPLiveScript repo:

  ▎ findMaxArgumentSize() crashes when an addExternal-registered function is used as a nested argument expression (e.g. setRGB(random16(n), color)). When an extern call is built as a sub-expression rather than a
  statement, children 1 and 2 are not populated; the existing code dereferences getChildAtPos(1) unconditionally → null-deref / LoadProhibited on ESP32.

  ▎ Fix: guard both getChildAtPos(1) and getChildAtPos(2) and return early with 0 if either is null. Zero is the correct return value for a scalar nested extern call (same as arithmetic sub-expressions).
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.

1 participant