Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion context_p->token.type != LEXER_COLON in parser_parse_case_statement #3123

Closed
renatahodovan opened this issue Sep 13, 2019 · 0 comments · Fixed by #3124
Closed

Assertion context_p->token.type != LEXER_COLON in parser_parse_case_statement #3123

renatahodovan opened this issue Sep 13, 2019 · 0 comments · Fixed by #3124
Labels
bug Undesired behaviour ES2015 Related to ES2015 features parser Related to the JavaScript parser

Comments

@renatahodovan
Copy link
Contributor

JerryScript revision

17e63e8

Build platform

Linux-4.15.0-62-generic-x86_64-with-Ubuntu-18.04-bionic

Build steps
./tools/build.py --clean --debug --compile-flag=-fsanitize=address \
--compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer \
--compile-flag=-fno-common --compile-flag=-g \
--strip=off --system-allocator=on --logging=on \
--linker-flag=-fuse-ld=gold --error-messages=on --profile=es2015-subset
Test case
switch ($) {
  case $: class $ {;}
  case 6:
}
Output
ICE: Assertion 'context_p->token.type != LEXER_COLON' failed at jerryscript/jerry-core/parser/js/js-parser-statm.c(parser_parse_case_statement):1556.
Error: ERR_FAILED_INTERNAL_ASSERTION
Backtrace
bt
#0  0xf7fd5079 in __kernel_vsyscall ()
#1  0xf77fc832 in raise () from /lib/i386-linux-gnu/libc.so.6
#2  0xf77fdcc1 in abort () from /lib/i386-linux-gnu/libc.so.6
#3  0x5657982f in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-port/default/default-fatal.c:71
#4  0x566138ae in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5  0x566138ef in jerry_assert_fail (assertion=0x56693cc0 "context_p->token.type != LEXER_COLON", file=0x56693be0 "jerryscript/jerry-core/parser/js/js-parser-statm.c", function=0x56694900 <__func__.5431> "parser_parse_case_statement", line=1556) at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6  0x5656bf11 in parser_parse_case_statement (context_p=0xffffc4b0) at jerryscript/jerry-core/parser/js/js-parser-statm.c:1556
#7  0x5656fed0 in parser_parse_statements (context_p=0xffffc4b0) at jerryscript/jerry-core/parser/js/js-parser-statm.c:2458
#8  0x565d38b4 in parser_parse_function (context_p=0xffffc4b0, status_flags=6) at jerryscript/jerry-core/parser/js/js-parser.c:2786
#9  0x565971ef in lexer_construct_function_object (context_p=0xffffc4b0, extra_status_flags=6) at jerryscript/jerry-core/parser/js/js-lexer.c:1978
#10 0x565acc4d in parser_parse_function_statement.lto_priv.178 (context_p=0xffffc4b0) at jerryscript/jerry-core/parser/js/js-parser-statm.c:469
#11 0x5656fae3 in parser_parse_statements (context_p=0xffffc4b0) at jerryscript/jerry-core/parser/js/js-parser-statm.c:2371
#12 0x565d1857 in parser_parse_source (arg_list_p=0x0, arg_list_size=0, source_p=0x566eeae0 <buffer.lto_priv> "function f ( x , y ) { switch ( x ) { case 1 : WScript .Echo ( 1 ) ; \nbreak ; \ncase 2 : WScript .Echo ( 2 ) ; \nbreak ; \ncase 3 : WScript .Echo ( 3 ) ; \nbreak ; \ncase 4 : WScript .Echo ( 4 ) ; \nbreak ;"..., source_size=1293, parse_opts=0, error_location_p=0xffffc6c0) at jerryscript/jerry-core/parser/js/js-parser.c:2530
#13 0x565d463e in parser_parse_script (arg_list_p=0x0, arg_list_size=0, source_p=0x566eeae0 <buffer.lto_priv> "function f ( x , y ) { switch ( x ) { case 1 : WScript .Echo ( 1 ) ; \nbreak ; \ncase 2 : WScript .Echo ( 2 ) ; \nbreak ; \ncase 3 : WScript .Echo ( 3 ) ; \nbreak ; \ncase 4 : WScript .Echo ( 4 ) ; \nbreak ;"..., source_size=1293, parse_opts=0, bytecode_data_p=0xffffc780) at jerryscript/jerry-core/parser/js/js-parser.c:2997
#14 0x56647356 in jerry_parse (resource_name_p=0xffffcd92 "/home/reni/.fuzzinator_34114//jerryscript/picireny/7716773234270039086542036664503419856.js", resource_name_length=91, source_p=0x566eeae0 <buffer.lto_priv> "function f ( x , y ) { switch ( x ) { case 1 : WScript .Echo ( 1 ) ; \nbreak ; \ncase 2 : WScript .Echo ( 2 ) ; \nbreak ; \ncase 3 : WScript .Echo ( 3 ) ; \nbreak ; \ncase 4 : WScript .Echo ( 4 ) ; \nbreak ;"..., source_size=1293, parse_opts=0) at jerryscript/jerry-core/api/jerry.c:420
#15 0x566442ab in main (argc=3, argv=0xffffcb14) at jerryscript/jerry-main/main-unix.c:734

Found by Fuzzinator with grammarinator.

@rerobika rerobika added bug Undesired behaviour ES2015 Related to ES2015 features parser Related to the JavaScript parser labels Sep 13, 2019
rerobika added a commit to rerobika/jerryscript that referenced this issue Sep 13, 2019
This patch fixes jerryscript-project#3123

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
zherczeg pushed a commit that referenced this issue Sep 16, 2019
This patch fixes #3123

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour ES2015 Related to ES2015 features parser Related to the JavaScript parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants