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 'flags & PARSER_PATTERN_HAS_REST_ELEMENT' failed at jerryscript/jerry-core/parser/js/js-parser-expr.c(parser_parse_object_initializer):4119. #4928

Closed
FlydragonTy opened this issue Jan 4, 2022 · 0 comments · Fixed by #4950
Assignees
Labels
bug Undesired behaviour

Comments

@FlydragonTy
Copy link

FlydragonTy commented Jan 4, 2022

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

var iterCount = 0;

async function JSEtest() {
  for await (var { a, b, ...rest }"of [{x: 1, y: 2, a: 5, b: 3}]) {
    assert.sameValue(rest.a, undefined);
  assert.sameValue(rest.b, undefined);

  verifyProperty(rest, "x", {
    enumerable: true,
    writable: true,
    configurable: true,
    value: 1
  });

  verifyProperty(rest, "y", {
    enumerable: true,
    writable: true,
    configurable: true,
    value: 2
  });

  iterCount += 1;
}

JSEtest()
  .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
  .then($DONE, $DONE);

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

ICE: Assertion 'flags & PARSER_PATTERN_HAS_REST_ELEMENT' failed at jerryscript/jerry-core/parser/js/js-parser-expr.c(parser_parse_object_initializer):4119.
Error: ERR_FAILED_INTERNAL_ASSERTION
[1]    32968 abort      jerry poc.js

Credits: Found by OWL337 team.

@rerobika rerobika added the bug Undesired behaviour label Jan 4, 2022
rerobika pushed a commit to rerobika/jerryscript that referenced this issue Jan 4, 2022
Since the scanner info is not present for invalid destructuring patterns we can only ensure the existence of the rest element after the pattern is finalized.
This patch fixes jerryscript-project#4928.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
@rerobika rerobika self-assigned this Jan 4, 2022
rerobika pushed a commit to rerobika/jerryscript that referenced this issue Jan 4, 2022
Since the scanner info is not present for invalid destructuring patterns we can only ensure the existence of the rest element after the pattern is finalized.
This patch fixes jerryscript-project#4928.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
ossy-szeged pushed a commit that referenced this issue Jan 14, 2022
Since the scanner info is not present for invalid destructuring patterns we can only ensure the existence of the rest element after the pattern is finalized.
This patch fixes #4928.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants