Skip to content

Commit 79738fe

Browse files
committed
Fixing out of stack AV in Destructuring pattern.
Probe stack first to see if the stack is available.
1 parent e2a9c77 commit 79738fe

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lib/Parser/Parse.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12842,6 +12842,9 @@ ParseNodePtr Parser::ParseDestructuredLiteral(tokens declarationType,
1284212842
{
1284312843
ParseNodeUni * pnode = nullptr;
1284412844
Assert(IsPossiblePatternStart());
12845+
12846+
PROBE_STACK_NO_DISPOSE(m_scriptContext, Js::Constants::MinStackDefault);
12847+
1284512848
if (m_token.tk == tkLCurly)
1284612849
{
1284712850
pnode = ParseDestructuredObjectLiteral<buildAST>(declarationType, isDecl, topLevel);

test/Bugs/misc_bugs.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,28 @@ var tests = [
189189
});
190190
}
191191
},
192+
{
193+
name: "destructuring : testing recursion",
194+
body: function () {
195+
try {
196+
eval(`
197+
var ${'['.repeat(6631)}
198+
`);
199+
assert.fail();
200+
}
201+
catch (e) {
202+
}
203+
204+
try {
205+
eval(`
206+
var {${'a:{'.repeat(6631)}
207+
`);
208+
assert.fail();
209+
}
210+
catch (e) {
211+
}
212+
}
213+
}
192214

193215
];
194216

0 commit comments

Comments
 (0)