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

Changeset 284807 in webkit


Ignore:
Timestamp:
Oct 25, 2021, 12:09:56 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r284573. rdar://problem/84329018

Add missing overflow checks to DFGIntegerRangeOptimizationPhase::isEquivalentTo()
https://bugs.webkit.org/show_bug.cgi?id=232024

Reviewed by Tadeu Zagallo.

Added overflow check before comparing for equality.

  • dfg/DFGIntegerRangeOptimizationPhase.cpp:

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

Location:
branches/safari-612-branch/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612-branch/Source/JavaScriptCore/ChangeLog

    r284806 r284807  
     12021-10-25  Null  <null@apple.com>
     2
     3        Cherry-pick r284573. rdar://problem/84329018
     4
     5    Add missing overflow checks to DFGIntegerRangeOptimizationPhase::isEquivalentTo()
     6    https://bugs.webkit.org/show_bug.cgi?id=232024
     7   
     8    Reviewed by Tadeu Zagallo.
     9   
     10    Added overflow check before comparing for equality.
     11   
     12    * dfg/DFGIntegerRangeOptimizationPhase.cpp:
     13   
     14   
     15    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     16
     17    2021-10-20  Michael Saboff  <msaboff@apple.com>
     18
     19            Add missing overflow checks to DFGIntegerRangeOptimizationPhase::isEquivalentTo()
     20            https://bugs.webkit.org/show_bug.cgi?id=232024
     21
     22            Reviewed by Tadeu Zagallo.
     23
     24            Added overflow check before comparing for equality.
     25
     26            * dfg/DFGIntegerRangeOptimizationPhase.cpp:
     27
    1282021-10-25  Null  <null@apple.com>
    229
  • branches/safari-612-branch/Source/JavaScriptCore/dfg/DFGIntegerRangeOptimizationPhase.cpp

    r284401 r284807  
    11/*
    2  * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    229229            return true;
    230230
    231         if (m_right->isInt32Constant() && other.m_right->isInt32Constant())
    232             return (m_right->asInt32() + m_offset) == (other.m_right->asInt32() + other.m_offset);
     231        if (m_right->isInt32Constant() && other.m_right->isInt32Constant()) {
     232            int thisRight = m_right->asInt32();
     233            int otherRight = other.m_right->asInt32();
     234
     235            if (sumOverflows<int>(thisRight, m_offset))
     236                return false;
     237            if (sumOverflows<int>(otherRight, other.m_offset))
     238                return false;
     239
     240            return (thisRight + m_offset) == (otherRight + other.m_offset);
     241        }
    233242        return false;
    234243    }
Note: See TracChangeset for help on using the changeset viewer.