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

Changeset 284573 in webkit


Ignore:
Timestamp:
Oct 20, 2021, 2:45:13 PM (5 years ago)
Author:
msaboff@apple.com
Message:

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:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r284533 r284573  
     12021-10-20  Michael Saboff  <msaboff@apple.com>
     2
     3        Add missing overflow checks to DFGIntegerRangeOptimizationPhase::isEquivalentTo()
     4        https://bugs.webkit.org/show_bug.cgi?id=232024
     5
     6        Reviewed by Tadeu Zagallo.
     7
     8        Added overflow check before comparing for equality.
     9
     10        * dfg/DFGIntegerRangeOptimizationPhase.cpp:
     11
    1122021-10-20  Michael Catanzaro  <mcatanzaro@gnome.org>
    213
  • trunk/Source/JavaScriptCore/dfg/DFGIntegerRangeOptimizationPhase.cpp

    r284330 r284573  
    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.