Skip to content

Conversation

rerobika
Copy link
Member

@rerobika rerobika commented Dec 7, 2021

This patch fixes #4847.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]

@rerobika rerobika added bug Undesired behaviour pre-scanner Related to the JavaScript pre-scanner labels Dec 7, 2021
@rerobika rerobika force-pushed the fix_arguments_object_creation branch 2 times, most recently from d8d2ec7 to fbb1d4c Compare December 7, 2021 11:30
@rerobika rerobika changed the title Prevent arguments object creation if arguments parameter is present Prevent arguments object creation if 'arguments' function argument is present Dec 7, 2021
… present

This patch fixes jerryscript-project#4847.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
@rerobika rerobika force-pushed the fix_arguments_object_creation branch from fbb1d4c to 3bb042b Compare December 7, 2021 11:38
{
/* 'arguments' function argument existence should prevent the arguments object construction */
new_literal_pool_p->status_flags =
(uint16_t) (new_literal_pool_p->status_flags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect style.

if (has_arguments)
{
/* Force the lexically stored arguments object creation */
literal_pool_p->status_flags |= (SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS | SCANNER_LITERAL_POOL_NO_ARGUMENTS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put the argument checking as a for loop here since the while (true) loop might also exit. This case is rare, so an extra loop should not cost much.

@zherczeg
Copy link
Member

zherczeg commented Dec 7, 2021

Note:

function f(arguments, eval = () => eval('')) { }

still crashes

rerobika pushed a commit to rerobika/jerryscript that referenced this pull request Dec 8, 2021
This patch is the followup of jerryscript-project#4849.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
rerobika pushed a commit to rerobika/jerryscript that referenced this pull request Dec 8, 2021
This patch is the followup of jerryscript-project#4849.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
ossy-szeged pushed a commit that referenced this pull request Dec 15, 2021
This patch is the followup of #4849.

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 pre-scanner Related to the JavaScript pre-scanner
Projects
None yet
4 participants