Skip to content

Commit

Permalink
[MERGE #5775 @akroshg] Fixing out of stack AV in Destructuring pattern.
Browse files Browse the repository at this point in the history
Merge pull request #5775 from akroshg:fix5773_1

Probe stack first to see if the stack is available.
  • Loading branch information
akroshg committed Oct 22, 2018
2 parents 1f6d785 + 79738fe commit 12cfbd0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Parser/Parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12874,6 +12874,9 @@ ParseNodePtr Parser::ParseDestructuredLiteral(tokens declarationType,
{
ParseNodeUni * pnode = nullptr;
Assert(IsPossiblePatternStart());

PROBE_STACK_NO_DISPOSE(m_scriptContext, Js::Constants::MinStackDefault);

if (m_token.tk == tkLCurly)
{
pnode = ParseDestructuredObjectLiteral<buildAST>(declarationType, isDecl, topLevel);
Expand Down
22 changes: 22 additions & 0 deletions test/Bugs/misc_bugs.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,28 @@ var tests = [
});
}
},
{
name: "destructuring : testing recursion",
body: function () {
try {
eval(`
var ${'['.repeat(6631)}
`);
assert.fail();
}
catch (e) {
}

try {
eval(`
var {${'a:{'.repeat(6631)}
`);
assert.fail();
}
catch (e) {
}
}
}

];

Expand Down

0 comments on commit 12cfbd0

Please sign in to comment.