jerryscript-project / jerryscript

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

Assertion 'scope_stack_p >= context_p->scope_stack_p' failed at jerry-core/parser/js/js-parser-statm.c(parser_parse_function_statement):741. #4919

Closed SwtWld closed 2 years ago

SwtWld commented 2 years ago
JerryScript revision

Commit: a6ab5e9

Version: v3.0.0

Build platform

Ubuntu 18.04.5 LTS (Linux 4.19.128-microsoft-standard x86_64)

Ubuntu 18.04.5 LTS (Linux 5.4.0-44-generic x86_64)

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
Test case
poc.js


```javascript
function JSEtest() {
  const v1 = [
      1337,
      1337
  ];
  let v2 = v1;
  with (100) {
      const v8 = {
          valueOf: 13.37,
          d: -2191938590,
          __proto__: 'ldq5vGcKyJ',
          {: 128
      };
      function v9(v10, v11, v12) {
          v2 = -1000;
          let v15 = arguments;
      }
      for (let v19 = 0; v19 < 100; v19++) {
          const v20 = v9(v8);
      }
  }
}
JSEtest();
```

Execution steps & Output
$ ./jerryscript/build/bin/jerry poc.js

ICE: Assertion 'scope_stack_p >= context_p->scope_stack_p' failed at /root/jerryscript/jerry-core/parser/js/js-parser-statm.c(parser_parse_function_statement):741.
Error: ERR_FAILED_INTERNAL_ASSERTION
[1]    23239 abort      jerry poc.js
rerobika commented 2 years ago

The main issue is similar to #4916. The problem is going to be resolved via #4942.