Skip to content

Commit 12cfbd0

Browse files
committed
[MERGE #5775 @akroshg] Fixing out of stack AV in Destructuring pattern.
Merge pull request #5775 from akroshg:fix5773_1 Probe stack first to see if the stack is available.
2 parents 1f6d785 + 79738fe commit 12cfbd0

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
@@ -12874,6 +12874,9 @@ ParseNodePtr Parser::ParseDestructuredLiteral(tokens declarationType,
1287412874
{
1287512875
ParseNodeUni * pnode = nullptr;
1287612876
Assert(IsPossiblePatternStart());
12877+
12878+
PROBE_STACK_NO_DISPOSE(m_scriptContext, Js::Constants::MinStackDefault);
12879+
1287712880
if (m_token.tk == tkLCurly)
1287812881
{
1287912882
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)