jerryscript-project / jerryscript

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

Assertion in parser_check_duplicated_private_field #5141

Closed Qbtly closed 2 weeks ago

Qbtly commented 1 month ago
Commit ID

47bd5d4b910a41fdc517e39edcf9220d8030a61f

Build platform

Ubuntu 22.04.3

Build steps
python3 ./tools/build.py --builddir=xxx --debug --clean --compile-flag=-fsanitize=address --compile-flag=-g --strip=off --lto=off --logging=on --line-info=on --error-message=on --stack-limit=20
Test case
class C { #get [Symbol]; }
Execution steps
./jerry poc.js
Output
Debug:
ICE: Assertion 'context_p->token.type == LEXER_LITERAL' failed at /jerryscript/jerry-core/parser/js/js-parser-expr.c(parser_check_duplicated_private_field):408.
Error: JERRY_FATAL_FAILED_ASSERTION

pwndbg> bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737350398144) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737350398144) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737350398144, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff7cb2476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff7c987f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x0000555555874565 in jerry_port_fatal (code=code@entry=JERRY_FATAL_FAILED_ASSERTION) at /jerryscript/jerry-port/common/jerry-port-process.c:29
#6  0x00005555557624d8 in jerry_fatal (code=code@entry=JERRY_FATAL_FAILED_ASSERTION) at /jerryscript/jerry-core/jrt/jrt-fatals.c:63
#7  0x000055555576238c in jerry_assert_fail (assertion=<optimized out>, file=<optimized out>, function=<optimized out>, line=line@entry=408) at /jerryscript/jerry-core/jrt/jrt-fatals.c:83
#8  0x0000555555848162 in parser_check_duplicated_private_field (context_p=context_p@entry=0x7fffffffde60, opts=<optimized out>) at /jerryscript/jerry-core/parser/js/js-parser-expr.c:408
#9  0x00005555558397df in parser_parse_class_body (context_p=0x7fffffffde60, opts=PARSER_CLASS_LITERAL_NO_OPTS, class_name_index=<optimized out>) at /jerryscript/jerry-core/parser/js/js-parser-expr.c:591
#10 parser_parse_class (context_p=0x7fffffffde60, is_statement=<optimized out>) at /jerryscript/jerry-core/parser/js/js-parser-expr.c:1110
#11 0x0000555555859f25 in parser_parse_statements (context_p=0x7fffffffde60) at /jerryscript/jerry-core/parser/js/js-parser-statm.c:2787
#12 0x000055555577c186 in parser_parse_source (source_p=source_p@entry=0x7ffff5e00aa0, parse_opts=parse_opts@entry=0, options_p=options_p@entry=0x7ffff5f00830) at /jerryscript/jerry-core/parser/js/js-parser.c:2280
#13 0x000055555577a501 in parser_parse_script (source_p=0x377884, source_p@entry=0x7ffff5e00aa0, parse_opts=3635332, parse_opts@entry=0, options_p=0x6, options_p@entry=0x7ffff5f00830) at /jerryscript/jerry-core/parser/js/js-parser.c:3332
#14 0x000055555568d3ca in jerry_parse_common (source_p=0x7ffff5e00aa0, options_p=options_p@entry=0x7ffff5f00830, parse_opts=parse_opts@entry=0) at /jerryscript/jerry-core/api/jerryscript.c:418
#15 0x000055555568d22c in jerry_parse (source_p=<optimized out>, source_size=<optimized out>, options_p=<optimized out>) at /jerryscript/jerry-core/api/jerryscript.c:486
#16 0x0000555555872ad2 in jerryx_source_parse_script (path_p=<optimized out>) at /jerryscript/jerry-ext/util/sources.c:52
#17 0x0000555555872cc4 in jerryx_source_exec_script (path_p=0x377884 <error: Cannot access memory at address 0x377884>) at /jerryscript/jerry-ext/util/sources.c:63
#18 0x00005555556860bc in main (argc=2, argv=<optimized out>) at /jerryscript/jerry-main/main-desktop.c:156
#19 0x00007ffff7c99d90 in __libc_start_call_main (main=main@entry=0x555555685a60 <main>, argc=argc@entry=2, argv=argv@entry=0x7fffffffe658) at ../sysdeps/nptl/libc_start_call_main.h:58
#20 0x00007ffff7c99e40 in __libc_start_main_impl (main=0x555555685a60 <main>, argc=2, argv=0x7fffffffe658, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe648) at ../csu/libc-start.c:392
#21 0x00005555555c5ed5 in _start ()