Skip to content

Conversation

@kylo5aby
Copy link
Contributor

Add native stack overflow detection to wasm_array_obj_new(),
wasm_struct_obj_new() to prevent potential stack overflow when those GC objects creation performs deep recursion.

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
@kylo5aby kylo5aby force-pushed the gc_objects branch 2 times, most recently from 10b4432 to ff896a8 Compare January 22, 2026 09:09
@lum1n0us
Copy link
Contributor

  • Native stack overflow checking is a good practice. However, besides that, memory (allocated) is another resource that can be exhausted due to recursion. So, I am considering directly limiting the nesting level to protect against both stack overflow and out-of-memory issues. Please share your comments.
  • We need a few regression test cases to cover these scenarios.

@lum1n0us lum1n0us added the bug-fix Determine if this PR addresses a bug. It will be used by scripts to classify PRs. label Jan 23, 2026
@kylo5aby
Copy link
Contributor Author

kylo5aby commented Jan 23, 2026

  • Native stack overflow checking is a good practice. However, besides that, memory (allocated) is another resource that can be exhausted due to recursion. So, I am considering directly limiting the nesting level to protect against both stack overflow and out-of-memory issues. Please share your comments.

for multiple levels of nesting, currently appears to handle this properly(just return NULL, to avoid heap overflow), this behavior seems inherently equivalent to creating numerous struct/array objects. If I'm wrong, please let me know.

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

Labels

bug-fix Determine if this PR addresses a bug. It will be used by scripts to classify PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants