**Commit:** 0ef509458e296056f0ccd48f4ea264134f3e5e06
**Tested on:** Ubuntu 18.04 LTS

## Build Steps

```
python ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-g --strip=off --lto=off --logging=on --line-info=on --error-message=on --system-allocator=on --stack-limit=20
```

## Execution steps & Output

```
$ ./jerry poc.js 
ICE: Assertion '(c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER' failed at /home/dhiraj/asan_jeyy/jerryscript/jerry-core/lit/lit-strings.c(lit_read_code_point_from_utf8):388.
Error: JERRY_FATAL_FAILED_ASSERTION
Aborted
```

## GDB

```
(gdb) r poc.js 
Starting program: /home/dhiraj/jerryscript/build/bin/jerry poc.js
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ICE: Assertion '(c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER' failed at /home/dhiraj/jerryscript/jerry-core/lit/lit-strings.c(lit_read_code_point_from_utf8):388.
Error: JERRY_FATAL_FAILED_ASSERTION

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7264859 in __GI_abort () at abort.c:79
#2  0x000055555575fc55 in jerry_port_fatal (code=JERRY_FATAL_FAILED_ASSERTION) at /home/dhiraj/jerryscript/jerry-port/common/jerry-port-process.c:29
#3  0x0000555555669017 in jerry_fatal (code=JERRY_FATAL_FAILED_ASSERTION) at /home/dhiraj/jerryscript/jerry-core/jrt/jrt-fatals.c:63
#4  0x0000555555669072 in jerry_assert_fail (assertion=0x555555799780 "(c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER", 
    file=0x5555557994c0 "/home/dhiraj/jerryscript/jerry-core/lit/lit-strings.c", function=0x55555579a040 <__func__.3695> "lit_read_code_point_from_utf8", line=388)
    at /home/dhiraj/jerryscript/jerry-core/jrt/jrt-fatals.c:83
#5  0x000055555566d2f2 in lit_read_code_point_from_utf8 (buf_p=0x61100000011d "\230", buf_size=1, code_point=0x7fffffffd5b0) at /home/dhiraj/jerryscript/jerry-core/lit/lit-strings.c:388
#6  0x000055555571917d in lexer_parse_identifier (context_p=0x7fffffffdc30, options=LEXER_PARSE_CHECK_KEYWORDS) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-lexer.c:671
#7  0x000055555571d3f4 in lexer_next_token (context_p=0x7fffffffdc30) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-lexer.c:1587
#8  0x00005555556926ac in scanner_scan_primary_expression_end (context_p=0x7fffffffdc30, scanner_context_p=0x7fffffffda60, type=LEXER_RIGHT_SQUARE, stack_top=SCAN_STACK_ARRAY_LITERAL)
    at /home/dhiraj/jerryscript/jerry-core/parser/js/js-scanner.c:955
#9  0x000055555569b887 in scanner_scan_all (context_p=0x7fffffffdc30) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-scanner.c:2901
#10 0x000055555567aa32 in parser_parse_source (source_p=0x7fffffffe040, parse_opts=0, options_p=0x7fffffffe110) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-parser.c:2226
#11 0x00005555556816e9 in parser_parse_script (source_p=0x7fffffffe040, parse_opts=0, options_p=0x7fffffffe110) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-parser.c:3421
#12 0x00005555555bc9d0 in jerry_parse_common (source_p=0x7fffffffe040, options_p=0x7fffffffe110, parse_opts=0) at /home/dhiraj/jerryscript/jerry-core/api/jerryscript.c:416
#13 0x00005555555bcd4e in jerry_parse (
    source_p=0x611000000040 "wd-QTTTCwi---function JSt() {\n  for (let v8 = 0; v8 < 127; v8++) {\n  for (let v15 = 2; v15 < 100; v15 = v1% + 10) {\n  try {\n      let\n      const v18 = v17.fromCharCode(10*4, v8, v15, v15, v8);\n      "..., source_size=222, options_p=0x7fffffffe110) at /home/dhiraj/jerryscript/jerry-core/api/jerryscript.c:484
#14 0x000055555575ea4b in jerryx_source_parse_script (path_p=0x7fffffffe731 "poc.js") at /home/dhiraj/jerryscript/jerry-ext/util/sources.c:52
#15 0x000055555575eb36 in jerryx_source_exec_script (path_p=0x7fffffffe731 "poc.js") at /home/dhiraj/jerryscript/jerry-ext/util/sources.c:63
#16 0x00005555555b85b5 in main (argc=2, argv=0x7fffffffe4a8) at /home/dhiraj/jerryscript/jerry-main/main-desktop.c:156
(gdb) 
```

**PoC:** [poc.zip](https://github.com/jerryscript-project/jerryscript/files/7905492/poc.zip)
Assertion '(c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER' failed atlit-strings.c(lit_read_code_point_from_utf8)
This is a GitHub Issue
repo:jerryscript
owner:jerryscript-project
Title : Assertion '(c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER' failed atlit-strings.c(lit_read_code_point_from_utf8)
Issue date:

--- start body ---
**Commit:** 0ef509458e296056f0ccd48f4ea264134f3e5e06
**Tested on:** Ubuntu 18.04 LTS

## Build Steps

```
python ./tools/build.py --clean --debug --compile-flag=-fsanitize=address --compile-flag=-m32 --compile-flag=-g --strip=off --lto=off --logging=on --line-info=on --error-message=on --system-allocator=on --stack-limit=20
```

## Execution steps & Output

```
$ ./jerry poc.js 
ICE: Assertion '(c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER' failed at /home/dhiraj/asan_jeyy/jerryscript/jerry-core/lit/lit-strings.c(lit_read_code_point_from_utf8):388.
Error: JERRY_FATAL_FAILED_ASSERTION
Aborted
```

## GDB

```
(gdb) r poc.js 
Starting program: /home/dhiraj/jerryscript/build/bin/jerry poc.js
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ICE: Assertion '(c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER' failed at /home/dhiraj/jerryscript/jerry-core/lit/lit-strings.c(lit_read_code_point_from_utf8):388.
Error: JERRY_FATAL_FAILED_ASSERTION

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7264859 in __GI_abort () at abort.c:79
#2  0x000055555575fc55 in jerry_port_fatal (code=JERRY_FATAL_FAILED_ASSERTION) at /home/dhiraj/jerryscript/jerry-port/common/jerry-port-process.c:29
#3  0x0000555555669017 in jerry_fatal (code=JERRY_FATAL_FAILED_ASSERTION) at /home/dhiraj/jerryscript/jerry-core/jrt/jrt-fatals.c:63
#4  0x0000555555669072 in jerry_assert_fail (assertion=0x555555799780 "(c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER", 
    file=0x5555557994c0 "/home/dhiraj/jerryscript/jerry-core/lit/lit-strings.c", function=0x55555579a040 <__func__.3695> "lit_read_code_point_from_utf8", line=388)
    at /home/dhiraj/jerryscript/jerry-core/jrt/jrt-fatals.c:83
#5  0x000055555566d2f2 in lit_read_code_point_from_utf8 (buf_p=0x61100000011d "\230", buf_size=1, code_point=0x7fffffffd5b0) at /home/dhiraj/jerryscript/jerry-core/lit/lit-strings.c:388
#6  0x000055555571917d in lexer_parse_identifier (context_p=0x7fffffffdc30, options=LEXER_PARSE_CHECK_KEYWORDS) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-lexer.c:671
#7  0x000055555571d3f4 in lexer_next_token (context_p=0x7fffffffdc30) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-lexer.c:1587
#8  0x00005555556926ac in scanner_scan_primary_expression_end (context_p=0x7fffffffdc30, scanner_context_p=0x7fffffffda60, type=LEXER_RIGHT_SQUARE, stack_top=SCAN_STACK_ARRAY_LITERAL)
    at /home/dhiraj/jerryscript/jerry-core/parser/js/js-scanner.c:955
#9  0x000055555569b887 in scanner_scan_all (context_p=0x7fffffffdc30) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-scanner.c:2901
#10 0x000055555567aa32 in parser_parse_source (source_p=0x7fffffffe040, parse_opts=0, options_p=0x7fffffffe110) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-parser.c:2226
#11 0x00005555556816e9 in parser_parse_script (source_p=0x7fffffffe040, parse_opts=0, options_p=0x7fffffffe110) at /home/dhiraj/jerryscript/jerry-core/parser/js/js-parser.c:3421
#12 0x00005555555bc9d0 in jerry_parse_common (source_p=0x7fffffffe040, options_p=0x7fffffffe110, parse_opts=0) at /home/dhiraj/jerryscript/jerry-core/api/jerryscript.c:416
#13 0x00005555555bcd4e in jerry_parse (
    source_p=0x611000000040 "wd-QTTTCwi---function JSt() {\n  for (let v8 = 0; v8 < 127; v8++) {\n  for (let v15 = 2; v15 < 100; v15 = v1% + 10) {\n  try {\n      let\n      const v18 = v17.fromCharCode(10*4, v8, v15, v15, v8);\n      "..., source_size=222, options_p=0x7fffffffe110) at /home/dhiraj/jerryscript/jerry-core/api/jerryscript.c:484
#14 0x000055555575ea4b in jerryx_source_parse_script (path_p=0x7fffffffe731 "poc.js") at /home/dhiraj/jerryscript/jerry-ext/util/sources.c:52
#15 0x000055555575eb36 in jerryx_source_exec_script (path_p=0x7fffffffe731 "poc.js") at /home/dhiraj/jerryscript/jerry-ext/util/sources.c:63
#16 0x00005555555b85b5 in main (argc=2, argv=0x7fffffffe4a8) at /home/dhiraj/jerryscript/jerry-main/main-desktop.c:156
(gdb) 
```

**PoC:** [poc.zip](https://github.com/jerryscript-project/jerryscript/files/7905492/poc.zip)
--- end body ---
