Fix potential native stack overflow in struct/array object creation#4800
Fix potential native stack overflow in struct/array object creation#4800kylo5aby wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
10b4432 to
ff896a8
Compare
|
for multiple levels of nesting, currently appears to handle this properly(just return |
|
Yes and no. Theoretically, whether it's the stack or heap, if they happen to be exhausted at the time of these two However, in practice, there are many functions and allocations along the chain of executing nested structs/arrays. Each point could potentially lead to resource exhaustion and an exception. Unless intercepted at the very beginning, it's challenging to catch all such instances during execution. Still, don't forget to add a few regression test cases to cover these scenarios. |
Agreed, I also think directly limiting the nesting level is a clearer standard, it can give more meaningful error info like "reach max recursion level" rather than "stack/heap overflow" |
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.