jerryscript-project / jerryscript

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

Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed at jerryscript/jerry-core/jmem/jmem-heap.c(jmem_heap_finalize):108. #5062

Open Ye0nny opened 1 year ago

Ye0nny commented 1 year ago
JerryScript revision

Commit: https://github.com/jerryscript-project/jerryscript/commit/1a2c04763aba49f52b1537acd3730098c873511c Version: v3.0.0

Build platform

Ubuntu 20.04.5 LTS (Linux 5.4.0-144-generic x86_64)

Build steps
python ./tools/build.py --clean --debug --compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer --compile-flag=-fno-common --compile-flag=-fsanitize=address --compile-flag=-g --strip=off --lto=off --error-messages=on --system-allocator=on --logging=on --line-info=on --stack-limit=20
Test case
// poc.js
( async ( ) => { for await ( const b of n ) { continue ;
Execution steps & Output
$ ./jerryscript/build/bin/jerry poc.js

^

Unhandled exception: SyntaxError: Unexpected end of input [poc.js:2:1]
ICE: Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed at jerryscript/jerry-core/jmem/jmem-heap.c(jmem_heap_finalize):108.
Error: JERRY_FATAL_FAILED_ASSERTION
Aborted
Backtrace
#0  0xf7fcfd99 in __kernel_vsyscall ()
#1  0xf7ca4276 in raise () from /lib32/libc.so.6
#2  0xf7c8c3f7 in abort () from /lib32/libc.so.6
#3  0x083ecca3 in jerry_port_fatal (code=JERRY_FATAL_FAILED_ASSERTION) at jerryscript/jerry-port/common/jerry-port-process.c:29
#4  0x08260d02 in jerry_fatal (code=JERRY_FATAL_FAILED_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:63
#5  0x08260d64 in jerry_assert_fail (assertion=0x84351c0 <str> "JERRY_CONTEXT (jmem_heap_allocated_size) == 0", file=0x8435220 <str> "jerryscript/jerry-core/jmem/jmem-heap.c", function=0x84352a0 <__func__.jmem_heap_finalize> "jmem_heap_finalize", line=108) at jerryscript/jerry-core/jrt/jrt-fatals.c:83
#6  0x0825ef5f in jmem_heap_finalize () at jerryscript/jerry-core/jmem/jmem-heap.c:108
#7  0x0825eab1 in jmem_finalize () at jerryscript/jerry-core/jmem/jmem-allocator.c:171
#8  0x08128c76 in jerry_cleanup () at jerryscript/jerry-core/api/jerryscript.c:240
#9  0x08122416 in main (argc=<optimized out>, argv=<optimized out>) at jerryscript/jerry-main/main-desktop.c:264

Credits: @Ye0nny, @EJueon of the seclab-yonsei.