Skip to content

Commit

Permalink
[CVE-2017-11908] Invalid stack restore when destructuring is used as …
Browse files Browse the repository at this point in the history
…a call param

The destructuring element in the call argslist was not correctly determined as we were not restoring the previous state.
    Fixed that
  • Loading branch information
akroshg authored and MikeHolman committed Dec 7, 2017
1 parent 760822c commit 39eecff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Parser/Parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ class Parser
: m_parser(parser)
{
m_prevState = m_parser->GetIsInParsingArgList();
m_prevDestructuringState = m_parser->GetHasDestructuringPattern();
m_parser->SetHasDestructuringPattern(false);
m_parser->SetIsInParsingArgList(true);
}
Expand All @@ -1135,11 +1136,20 @@ class Parser
{
m_parser->SetHasDestructuringPattern(false);
}
else
{
// Reset back to previous state only when the current call node does not have usage of destructuring expression.
if (!m_parser->GetHasDestructuringPattern())
{
m_parser->SetHasDestructuringPattern(m_prevDestructuringState);
}
}
}

private:
Parser *m_parser;
bool m_prevState;
bool m_prevDestructuringState;
};

public:
Expand Down

0 comments on commit 39eecff

Please sign in to comment.