<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[242445] releases/WebKitGTK/webkit-2.24/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/242445">242445</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2019-03-05 04:40:50 -0800 (Tue, 05 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/241991">r241991</a> - Add an exception check and some assertions in StringPrototype.cpp.
https://bugs.webkit.org/show_bug.cgi?id=194962
<rdar://problem/48013416>

Reviewed by Yusuke Suzuki and Saam Barati.

Source/JavaScriptCore:

* runtime/StringPrototype.cpp:
(JSC::jsSpliceSubstrings):
(JSC::jsSpliceSubstringsWithSeparators):
(JSC::operationStringProtoFuncReplaceRegExpEmptyStr):

Source/WTF:

Add an AssertNoOverflow overflow handler which allows us to do CheckedArithmetic
for assertion purpose only on debug builds but sacrifices no performance on
release builds.

* wtf/CheckedArithmetic.h:
(WTF::AssertNoOverflow::overflowed):
(WTF::AssertNoOverflow::clearOverflow):
(WTF::AssertNoOverflow::crash):
(WTF::AssertNoOverflow::hasOverflowed const):
(WTF::observesOverflow):
(WTF::observesOverflow<AssertNoOverflow>):
(WTF::safeAdd):
(WTF::safeSub):
(WTF::safeMultiply):
(WTF::Checked::operator+=):
(WTF::Checked::operator-=):
(WTF::Checked::operator*=):
(WTF::operator+):
(WTF::operator-):
(WTF::operator*):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit224SourceJavaScriptCoreChangeLog">releases/WebKitGTK/webkit-2.24/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceJavaScriptCoreruntimeStringPrototypecpp">releases/WebKitGTK/webkit-2.24/Source/JavaScriptCore/runtime/StringPrototype.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWTFChangeLog">releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourceWTFwtfCheckedArithmetich">releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/CheckedArithmetic.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit224SourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/JavaScriptCore/ChangeLog (242444 => 242445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/JavaScriptCore/ChangeLog   2019-03-05 12:40:47 UTC (rev 242444)
+++ releases/WebKitGTK/webkit-2.24/Source/JavaScriptCore/ChangeLog      2019-03-05 12:40:50 UTC (rev 242445)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2019-02-23  Mark Lam  <mark.lam@apple.com>
+
+        Add an exception check and some assertions in StringPrototype.cpp.
+        https://bugs.webkit.org/show_bug.cgi?id=194962
+        <rdar://problem/48013416>
+
+        Reviewed by Yusuke Suzuki and Saam Barati.
+
+        * runtime/StringPrototype.cpp:
+        (JSC::jsSpliceSubstrings):
+        (JSC::jsSpliceSubstringsWithSeparators):
+        (JSC::operationStringProtoFuncReplaceRegExpEmptyStr):
+
</ins><span class="cx"> 2019-02-22  Robin Morisset  <rmorisset@apple.com>
</span><span class="cx"> 
</span><span class="cx">         DFGBytecodeParser should not declare that a node won't clobberExit if DFGFixupPhase can later declare it does clobberExit
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceJavaScriptCoreruntimeStringPrototypecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/JavaScriptCore/runtime/StringPrototype.cpp (242444 => 242445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/JavaScriptCore/runtime/StringPrototype.cpp 2019-03-05 12:40:47 UTC (rev 242444)
+++ releases/WebKitGTK/webkit-2.24/Source/JavaScriptCore/runtime/StringPrototype.cpp    2019-03-05 12:40:50 UTC (rev 242445)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
</span><del>- *  Copyright (C) 2004-2017 Apple Inc. All rights reserved.
</del><ins>+ *  Copyright (C) 2004-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *  Copyright (C) 2009 Torch Mobile, Inc.
</span><span class="cx">  *  Copyright (C) 2015 Jordan Harband (ljharb@gmail.com)
</span><span class="cx">  *
</span><span class="lines">@@ -324,9 +324,14 @@
</span><span class="cx">         RELEASE_AND_RETURN(scope, jsString(exec, StringImpl::createSubstringSharingImpl(*source.impl(), std::max(0, position), std::min(sourceSize, length))));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int totalLength = 0;
</del><ins>+    // We know that the sum of substringRanges lengths cannot exceed length of
+    // source because the substringRanges were computed from the source string
+    // in removeUsingRegExpSearch(). Hence, totalLength cannot exceed
+    // String::MaxLength, and therefore, cannot overflow.
+    Checked<int, AssertNoOverflow> totalLength = 0;
</ins><span class="cx">     for (int i = 0; i < rangeCount; i++)
</span><span class="cx">         totalLength += substringRanges[i].length;
</span><ins>+    ASSERT(totalLength <= String::MaxLength);
</ins><span class="cx"> 
</span><span class="cx">     if (!totalLength)
</span><span class="cx">         return jsEmptyString(exec);
</span><span class="lines">@@ -334,16 +339,16 @@
</span><span class="cx">     if (source.is8Bit()) {
</span><span class="cx">         LChar* buffer;
</span><span class="cx">         const LChar* sourceData = source.characters8();
</span><del>-        auto impl = StringImpl::tryCreateUninitialized(totalLength, buffer);
</del><ins>+        auto impl = StringImpl::tryCreateUninitialized(totalLength.unsafeGet(), buffer);
</ins><span class="cx">         if (!impl) {
</span><span class="cx">             throwOutOfMemoryError(exec, scope);
</span><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        int bufferPos = 0;
</del><ins>+        Checked<int, AssertNoOverflow> bufferPos = 0;
</ins><span class="cx">         for (int i = 0; i < rangeCount; i++) {
</span><span class="cx">             if (int srcLen = substringRanges[i].length) {
</span><del>-                StringImpl::copyCharacters(buffer + bufferPos, sourceData + substringRanges[i].position, srcLen);
</del><ins>+                StringImpl::copyCharacters(buffer + bufferPos.unsafeGet(), sourceData + substringRanges[i].position, srcLen);
</ins><span class="cx">                 bufferPos += srcLen;
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -354,16 +359,16 @@
</span><span class="cx">     UChar* buffer;
</span><span class="cx">     const UChar* sourceData = source.characters16();
</span><span class="cx"> 
</span><del>-    auto impl = StringImpl::tryCreateUninitialized(totalLength, buffer);
</del><ins>+    auto impl = StringImpl::tryCreateUninitialized(totalLength.unsafeGet(), buffer);
</ins><span class="cx">     if (!impl) {
</span><span class="cx">         throwOutOfMemoryError(exec, scope);
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int bufferPos = 0;
</del><ins>+    Checked<int, AssertNoOverflow> bufferPos = 0;
</ins><span class="cx">     for (int i = 0; i < rangeCount; i++) {
</span><span class="cx">         if (int srcLen = substringRanges[i].length) {
</span><del>-            StringImpl::copyCharacters(buffer + bufferPos, sourceData + substringRanges[i].position, srcLen);
</del><ins>+            StringImpl::copyCharacters(buffer + bufferPos.unsafeGet(), sourceData + substringRanges[i].position, srcLen);
</ins><span class="cx">             bufferPos += srcLen;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -414,17 +419,17 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         int maxCount = std::max(rangeCount, separatorCount);
</span><del>-        int bufferPos = 0;
</del><ins>+        Checked<int, AssertNoOverflow> bufferPos = 0;
</ins><span class="cx">         for (int i = 0; i < maxCount; i++) {
</span><span class="cx">             if (i < rangeCount) {
</span><span class="cx">                 if (int srcLen = substringRanges[i].length) {
</span><del>-                    StringImpl::copyCharacters(buffer + bufferPos, sourceData + substringRanges[i].position, srcLen);
</del><ins>+                    StringImpl::copyCharacters(buffer + bufferPos.unsafeGet(), sourceData + substringRanges[i].position, srcLen);
</ins><span class="cx">                     bufferPos += srcLen;
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">             if (i < separatorCount) {
</span><span class="cx">                 if (int sepLen = separators[i].length()) {
</span><del>-                    StringImpl::copyCharacters(buffer + bufferPos, separators[i].characters8(), sepLen);
</del><ins>+                    StringImpl::copyCharacters(buffer + bufferPos.unsafeGet(), separators[i].characters8(), sepLen);
</ins><span class="cx">                     bufferPos += sepLen;
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -441,14 +446,14 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     int maxCount = std::max(rangeCount, separatorCount);
</span><del>-    int bufferPos = 0;
</del><ins>+    Checked<int, AssertNoOverflow> bufferPos = 0;
</ins><span class="cx">     for (int i = 0; i < maxCount; i++) {
</span><span class="cx">         if (i < rangeCount) {
</span><span class="cx">             if (int srcLen = substringRanges[i].length) {
</span><span class="cx">                 if (source.is8Bit())
</span><del>-                    StringImpl::copyCharacters(buffer + bufferPos, source.characters8() + substringRanges[i].position, srcLen);
</del><ins>+                    StringImpl::copyCharacters(buffer + bufferPos.unsafeGet(), source.characters8() + substringRanges[i].position, srcLen);
</ins><span class="cx">                 else
</span><del>-                    StringImpl::copyCharacters(buffer + bufferPos, source.characters16() + substringRanges[i].position, srcLen);
</del><ins>+                    StringImpl::copyCharacters(buffer + bufferPos.unsafeGet(), source.characters16() + substringRanges[i].position, srcLen);
</ins><span class="cx">                 bufferPos += srcLen;
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -455,9 +460,9 @@
</span><span class="cx">         if (i < separatorCount) {
</span><span class="cx">             if (int sepLen = separators[i].length()) {
</span><span class="cx">                 if (separators[i].is8Bit())
</span><del>-                    StringImpl::copyCharacters(buffer + bufferPos, separators[i].characters8(), sepLen);
</del><ins>+                    StringImpl::copyCharacters(buffer + bufferPos.unsafeGet(), separators[i].characters8(), sepLen);
</ins><span class="cx">                 else
</span><del>-                    StringImpl::copyCharacters(buffer + bufferPos, separators[i].characters16(), sepLen);
</del><ins>+                    StringImpl::copyCharacters(buffer + bufferPos.unsafeGet(), separators[i].characters16(), sepLen);
</ins><span class="cx">                 bufferPos += sepLen;
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -729,7 +734,9 @@
</span><span class="cx">         // ES5.1 15.5.4.10 step 8.a.
</span><span class="cx">         searchValue->setLastIndex(exec, 0);
</span><span class="cx">         RETURN_IF_EXCEPTION(scope, nullptr);
</span><del>-        RELEASE_AND_RETURN(scope, removeUsingRegExpSearch(vm, exec, thisValue, thisValue->value(exec), regExp));
</del><ins>+        const String& source = thisValue->value(exec);
+        RETURN_IF_EXCEPTION(scope, nullptr);
+        RELEASE_AND_RETURN(scope, removeUsingRegExpSearch(vm, exec, thisValue, source, regExp));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     CallData callData;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog (242444 => 242445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog      2019-03-05 12:40:47 UTC (rev 242444)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog 2019-03-05 12:40:50 UTC (rev 242445)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2019-02-23  Mark Lam  <mark.lam@apple.com>
+
+        Add an exception check and some assertions in StringPrototype.cpp.
+        https://bugs.webkit.org/show_bug.cgi?id=194962
+        <rdar://problem/48013416>
+
+        Reviewed by Yusuke Suzuki and Saam Barati.
+
+        Add an AssertNoOverflow overflow handler which allows us to do CheckedArithmetic
+        for assertion purpose only on debug builds but sacrifices no performance on
+        release builds.
+
+        * wtf/CheckedArithmetic.h:
+        (WTF::AssertNoOverflow::overflowed):
+        (WTF::AssertNoOverflow::clearOverflow):
+        (WTF::AssertNoOverflow::crash):
+        (WTF::AssertNoOverflow::hasOverflowed const):
+        (WTF::observesOverflow):
+        (WTF::observesOverflow<AssertNoOverflow>):
+        (WTF::safeAdd):
+        (WTF::safeSub):
+        (WTF::safeMultiply):
+        (WTF::Checked::operator+=):
+        (WTF::Checked::operator-=):
+        (WTF::Checked::operator*=):
+        (WTF::operator+):
+        (WTF::operator-):
+        (WTF::operator*):
+
</ins><span class="cx"> 2019-02-20  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         URL percent-encode operations should use checked arithmetic for buffer allocation length
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourceWTFwtfCheckedArithmetich"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/CheckedArithmetic.h (242444 => 242445)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/CheckedArithmetic.h        2019-03-05 12:40:47 UTC (rev 242444)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/CheckedArithmetic.h   2019-03-05 12:40:50 UTC (rev 242445)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -70,6 +70,24 @@
</span><span class="cx">     DidNotOverflow
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+class AssertNoOverflow {
+public:
+    static NO_RETURN_DUE_TO_ASSERT void overflowed()
+    {
+        ASSERT_NOT_REACHED();
+    }
+
+    void clearOverflow() { }
+
+    static NO_RETURN_DUE_TO_CRASH void crash()
+    {
+        CRASH();
+    }
+
+public:
+    constexpr bool hasOverflowed() const { return false; }
+};
+
</ins><span class="cx"> class ConditionalCrashOnOverflow {
</span><span class="cx"> public:
</span><span class="cx">     void overflowed()
</span><span class="lines">@@ -523,21 +541,55 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+template <class OverflowHandler, typename = std::enable_if_t<!std::is_scalar<OverflowHandler>::value>>
+inline constexpr bool observesOverflow() { return true; }
+
+template <>
+inline constexpr bool observesOverflow<AssertNoOverflow>() { return !ASSERT_DISABLED; }
+
</ins><span class="cx"> template <typename U, typename V, typename R> static inline bool safeAdd(U lhs, V rhs, R& result)
</span><span class="cx"> {
</span><span class="cx">     return ArithmeticOperations<U, V, R>::add(lhs, rhs, result);
</span><ins>+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template <class OverflowHandler, typename U, typename V, typename R, typename = std::enable_if_t<!std::is_scalar<OverflowHandler>::value>>
+static inline bool safeAdd(U lhs, V rhs, R& result)
+{
+    if (observesOverflow<OverflowHandler>())
+        return safeAdd(lhs, rhs, result);
+    result = lhs + rhs;
+    return true;
+}
+
</ins><span class="cx"> template <typename U, typename V, typename R> static inline bool safeSub(U lhs, V rhs, R& result)
</span><span class="cx"> {
</span><span class="cx">     return ArithmeticOperations<U, V, R>::sub(lhs, rhs, result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template <class OverflowHandler, typename U, typename V, typename R, typename = std::enable_if_t<!std::is_scalar<OverflowHandler>::value>>
+static inline bool safeSub(U lhs, V rhs, R& result)
+{
+    if (observesOverflow<OverflowHandler>())
+        return safeSub(lhs, rhs, result);
+    result = lhs - rhs;
+    return true;
+}
+
</ins><span class="cx"> template <typename U, typename V, typename R> static inline bool safeMultiply(U lhs, V rhs, R& result)
</span><span class="cx"> {
</span><span class="cx">     return ArithmeticOperations<U, V, R>::multiply(lhs, rhs, result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template <class OverflowHandler, typename U, typename V, typename R, typename = std::enable_if_t<!std::is_scalar<OverflowHandler>::value>>
+static inline bool safeMultiply(U lhs, V rhs, R& result)
+{
+    if (observesOverflow<OverflowHandler>())
+        return safeMultiply(lhs, rhs, result);
+    result = lhs * rhs;
+    return true;
+}
+
</ins><span class="cx"> template <typename U, typename V> static inline bool safeEquals(U lhs, V rhs)
</span><span class="cx"> {
</span><span class="cx">     return ArithmeticOperations<U, V>::equals(lhs, rhs);
</span><span class="lines">@@ -676,7 +728,7 @@
</span><span class="cx">     // Mutating assignment
</span><span class="cx">     template <typename U> const Checked operator+=(U rhs)
</span><span class="cx">     {
</span><del>-        if (!safeAdd(m_value, rhs, m_value))
</del><ins>+        if (!safeAdd<OverflowHandler>(m_value, rhs, m_value))
</ins><span class="cx">             this->overflowed();
</span><span class="cx">         return *this;
</span><span class="cx">     }
</span><span class="lines">@@ -683,7 +735,7 @@
</span><span class="cx"> 
</span><span class="cx">     template <typename U> const Checked operator-=(U rhs)
</span><span class="cx">     {
</span><del>-        if (!safeSub(m_value, rhs, m_value))
</del><ins>+        if (!safeSub<OverflowHandler>(m_value, rhs, m_value))
</ins><span class="cx">             this->overflowed();
</span><span class="cx">         return *this;
</span><span class="cx">     }
</span><span class="lines">@@ -690,7 +742,7 @@
</span><span class="cx"> 
</span><span class="cx">     template <typename U> const Checked operator*=(U rhs)
</span><span class="cx">     {
</span><del>-        if (!safeMultiply(m_value, rhs, m_value))
</del><ins>+        if (!safeMultiply<OverflowHandler>(m_value, rhs, m_value))
</ins><span class="cx">             this->overflowed();
</span><span class="cx">         return *this;
</span><span class="cx">     }
</span><span class="lines">@@ -814,7 +866,7 @@
</span><span class="cx">     V y = 0;
</span><span class="cx">     bool overflowed = lhs.safeGet(x) == CheckedState::DidOverflow || rhs.safeGet(y) == CheckedState::DidOverflow;
</span><span class="cx">     typename Result<U, V>::ResultType result = 0;
</span><del>-    overflowed |= !safeAdd(x, y, result);
</del><ins>+    overflowed |= !safeAdd<OverflowHandler>(x, y, result);
</ins><span class="cx">     if (overflowed)
</span><span class="cx">         return ResultOverflowed;
</span><span class="cx">     return result;
</span><span class="lines">@@ -826,7 +878,7 @@
</span><span class="cx">     V y = 0;
</span><span class="cx">     bool overflowed = lhs.safeGet(x) == CheckedState::DidOverflow || rhs.safeGet(y) == CheckedState::DidOverflow;
</span><span class="cx">     typename Result<U, V>::ResultType result = 0;
</span><del>-    overflowed |= !safeSub(x, y, result);
</del><ins>+    overflowed |= !safeSub<OverflowHandler>(x, y, result);
</ins><span class="cx">     if (overflowed)
</span><span class="cx">         return ResultOverflowed;
</span><span class="cx">     return result;
</span><span class="lines">@@ -838,7 +890,7 @@
</span><span class="cx">     V y = 0;
</span><span class="cx">     bool overflowed = lhs.safeGet(x) == CheckedState::DidOverflow || rhs.safeGet(y) == CheckedState::DidOverflow;
</span><span class="cx">     typename Result<U, V>::ResultType result = 0;
</span><del>-    overflowed |= !safeMultiply(x, y, result);
</del><ins>+    overflowed |= !safeMultiply<OverflowHandler>(x, y, result);
</ins><span class="cx">     if (overflowed)
</span><span class="cx">         return ResultOverflowed;
</span><span class="cx">     return result;
</span><span class="lines">@@ -930,6 +982,7 @@
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+using WTF::AssertNoOverflow;
</ins><span class="cx"> using WTF::Checked;
</span><span class="cx"> using WTF::CheckedState;
</span><span class="cx"> using WTF::CheckedInt8;
</span></span></pre>
</div>
</div>

</body>
</html>