jerryscript-project / jerryscript

Ultra-lightweight JavaScript engine for the Internet of Things.
https://jerryscript.net
Apache License 2.0
6.89k stars 669 forks source link

Memory question under loop #5041

Open AidPaike opened 1 year ago

AidPaike commented 1 year ago

Version

Version: 3.0.0 ( 1a2c047 )

Execution steps

/root/.jsvu/jerry Testcase.js

Testcase

var foo = function() {
    var s = "[0";
    for (var i = 0; i < (128 << 10); i++) {
        s += "[0-9]";
    }
    s += "]";
    return eval(s);
}
var foo1 = foo();
print(foo1); 

Output

ICE: Assertion 'jmem_is_heap_pointer ((void *) uint_ptr)' failed at /root/js_engines/jerryscript/jerry-core/jmem/jmem-allocator.c(jmem_decompress_pointer):229.
Error: ERR_FAILED_INTERNAL_ASSERTION

Expected behavior

Error: Out of stack space

Description

There seems to be a lack of memory overflow detection, perhaps similar to circular calls
#5039, but ideally dead loops should be detected initially and memory overflow should be caught

Hope jerryscript gets better and better
Looking forward to your reply :)