⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246379 in webkit


Ignore:
Timestamp:
Jun 12, 2019, 3:20:54 PM (7 years ago)
Author:
Kocsen Chung
Message:

Cherry-pick r246071. rdar://problem/51656838

Argument elimination should check for negative indices in GetByVal
https://bugs.webkit.org/show_bug.cgi?id=198302
<rdar://problem/51188095>

Reviewed by Filip Pizlo.

JSTests:

  • stress/eliminate-arguments-negative-rest-access.js: Added. (inlinee): (opt):

Source/JavaScriptCore:

In DFG::ArgumentEliminationPhase, the index is treated as unsigned, but there's no check
for overflow in the addition. In compileGetMyArgumentByVal, there's a check for overflow,
but the index is treated as signed, resulting in an index lower than numberOfArgumentsToSkip.

  • dfg/DFGArgumentsEliminationPhase.cpp:
  • ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileGetMyArgumentByVal):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246071 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-607-branch
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/JSTests/ChangeLog

    r245928 r246379  
     12019-06-12  Null  <null@apple.com>
     2
     3        Cherry-pick r246071. rdar://problem/51656838
     4
     5    Argument elimination should check for negative indices in GetByVal
     6    https://bugs.webkit.org/show_bug.cgi?id=198302
     7    <rdar://problem/51188095>
     8   
     9    Reviewed by Filip Pizlo.
     10   
     11    JSTests:
     12   
     13    * stress/eliminate-arguments-negative-rest-access.js: Added.
     14    (inlinee):
     15    (opt):
     16   
     17    Source/JavaScriptCore:
     18   
     19    In DFG::ArgumentEliminationPhase, the index is treated as unsigned, but there's no check
     20    for overflow in the addition. In compileGetMyArgumentByVal, there's a check for overflow,
     21    but the index is treated as signed, resulting in an index lower than numberOfArgumentsToSkip.
     22   
     23    * dfg/DFGArgumentsEliminationPhase.cpp:
     24    * ftl/FTLLowerDFGToB3.cpp:
     25    (JSC::FTL::DFG::LowerDFGToB3::compileGetMyArgumentByVal):
     26   
     27    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     28
     29    2019-06-04  Tadeu Zagallo  <tzagallo@apple.com>
     30
     31            Argument elimination should check for negative indices in GetByVal
     32            https://bugs.webkit.org/show_bug.cgi?id=198302
     33            <rdar://problem/51188095>
     34
     35            Reviewed by Filip Pizlo.
     36
     37            * stress/eliminate-arguments-negative-rest-access.js: Added.
     38            (inlinee):
     39            (opt):
     40
    1412019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
    242
  • branches/safari-607-branch/Source/JavaScriptCore/ChangeLog

    r246378 r246379  
     12019-06-12  Null  <null@apple.com>
     2
     3        Cherry-pick r246071. rdar://problem/51656838
     4
     5    Argument elimination should check for negative indices in GetByVal
     6    https://bugs.webkit.org/show_bug.cgi?id=198302
     7    <rdar://problem/51188095>
     8   
     9    Reviewed by Filip Pizlo.
     10   
     11    JSTests:
     12   
     13    * stress/eliminate-arguments-negative-rest-access.js: Added.
     14    (inlinee):
     15    (opt):
     16   
     17    Source/JavaScriptCore:
     18   
     19    In DFG::ArgumentEliminationPhase, the index is treated as unsigned, but there's no check
     20    for overflow in the addition. In compileGetMyArgumentByVal, there's a check for overflow,
     21    but the index is treated as signed, resulting in an index lower than numberOfArgumentsToSkip.
     22   
     23    * dfg/DFGArgumentsEliminationPhase.cpp:
     24    * ftl/FTLLowerDFGToB3.cpp:
     25    (JSC::FTL::DFG::LowerDFGToB3::compileGetMyArgumentByVal):
     26   
     27    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     28
     29    2019-06-04  Tadeu Zagallo  <tzagallo@apple.com>
     30
     31            Argument elimination should check for negative indices in GetByVal
     32            https://bugs.webkit.org/show_bug.cgi?id=198302
     33            <rdar://problem/51188095>
     34
     35            Reviewed by Filip Pizlo.
     36
     37            In DFG::ArgumentEliminationPhase, the index is treated as unsigned, but there's no check
     38            for overflow in the addition. In compileGetMyArgumentByVal, there's a check for overflow,
     39            but the index is treated as signed, resulting in an index lower than numberOfArgumentsToSkip.
     40
     41            * dfg/DFGArgumentsEliminationPhase.cpp:
     42            * ftl/FTLLowerDFGToB3.cpp:
     43            (JSC::FTL::DFG::LowerDFGToB3::compileGetMyArgumentByVal):
     44
    1452019-06-12  Null  <null@apple.com>
    246
  • branches/safari-607-branch/Source/JavaScriptCore/dfg/DFGArgumentsEliminationPhase.cpp

    r241458 r246379  
    757757                        index += numberOfArgumentsToSkip;
    758758                       
    759                         bool safeToGetStack;
     759                        bool safeToGetStack = index >= numberOfArgumentsToSkip;
    760760                        if (inlineCallFrame)
    761                             safeToGetStack = index < inlineCallFrame->argumentCountIncludingThis - 1;
     761                            safeToGetStack &= index < inlineCallFrame->argumentCountIncludingThis - 1;
    762762                        else {
    763                             safeToGetStack =
     763                            safeToGetStack &=
    764764                                index < static_cast<unsigned>(codeBlock()->numParameters()) - 1;
    765765                        }
  • branches/safari-607-branch/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r243577 r246379  
    42334233        LValue numberOfArgs = m_out.sub(numberOfArgsIncludingThis, m_out.int32One);
    42344234        LValue indexToCheck = originalIndex;
     4235        LValue numberOfArgumentsToSkip = m_out.int32Zero;
    42354236        if (m_node->numberOfArgumentsToSkip()) {
    4236             CheckValue* check = m_out.speculateAdd(indexToCheck, m_out.constInt32(m_node->numberOfArgumentsToSkip()));
     4237            numberOfArgumentsToSkip = m_out.constInt32(m_node->numberOfArgumentsToSkip());
     4238            CheckValue* check = m_out.speculateAdd(indexToCheck, numberOfArgumentsToSkip);
    42374239            blessSpeculation(check, Overflow, noValue(), nullptr, m_origin);
    42384240            indexToCheck = check;
    42394241        }
    42404242
    4241         LValue isOutOfBounds = m_out.aboveOrEqual(indexToCheck, numberOfArgs);
     4243        LValue isOutOfBounds = m_out.bitOr(m_out.aboveOrEqual(indexToCheck, numberOfArgs), m_out.below(indexToCheck, numberOfArgumentsToSkip));
    42424244        LBasicBlock continuation = nullptr;
    42434245        LBasicBlock lastNext = nullptr;
Note: See TracChangeset for help on using the changeset viewer.