<!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>[282533] releases/WebKitGTK/webkit-2.32</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/282533">282533</a></dd>
<dt>Author</dt> <dd>aperez@igalia.com</dd>
<dt>Date</dt> <dd>2021-09-16 03:36:30 -0700 (Thu, 16 Sep 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/278177">r278177</a> - Increase NumberToStringBuffer to account for negative number
https://bugs.webkit.org/show_bug.cgi?id=226014

Patch by Mikhail R. Gadelha <mikhail.ramalho@gmail.com> on 2021-05-27
Reviewed by Robin Morisset.

In <a href="http://trac.webkit.org/projects/webkit/changeset/250389">r250389</a>, NumberToStringBuffer length was increased from 96 to 123 because:

<21 digits> + decimal point + <100 digits> + null char = 123.

however,

a = -100000000000000000000
a.toFixed(100)

is a valid conversion and it is 124 chars long, because of the "-" sign.

So this patch increases the length of NumberToStringBuffer to 124 and adds new
test cases.

Source/WTF:

Reviewed by Ryosuke Niwa.

* wtf/dtoa.h:

LayoutTests:

* js/dom/number-tofixed-expected.txt:
* js/dom/script-tests/number-tofixed.js:
* js/kde/Number-expected.txt:
* js/kde/script-tests/Number.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit232LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.32/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit232LayoutTestsjsdomnumbertofixedexpectedtxt">releases/WebKitGTK/webkit-2.32/LayoutTests/js/dom/number-tofixed-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit232LayoutTestsjsdomscripttestsnumbertofixedjs">releases/WebKitGTK/webkit-2.32/LayoutTests/js/dom/script-tests/number-tofixed.js</a></li>
<li><a href="#releasesWebKitGTKwebkit232LayoutTestsjskdeNumberexpectedtxt">releases/WebKitGTK/webkit-2.32/LayoutTests/js/kde/Number-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit232LayoutTestsjskdescripttestsNumberjs">releases/WebKitGTK/webkit-2.32/LayoutTests/js/kde/script-tests/Number.js</a></li>
<li><a href="#releasesWebKitGTKwebkit232SourceWTFChangeLog">releases/WebKitGTK/webkit-2.32/Source/WTF/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit232SourceWTFwtfdtoah">releases/WebKitGTK/webkit-2.32/Source/WTF/wtf/dtoa.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit232LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.32/LayoutTests/ChangeLog (282532 => 282533)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.32/LayoutTests/ChangeLog     2021-09-16 10:36:22 UTC (rev 282532)
+++ releases/WebKitGTK/webkit-2.32/LayoutTests/ChangeLog        2021-09-16 10:36:30 UTC (rev 282533)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2021-05-27  Mikhail R. Gadelha  <mikhail.ramalho@gmail.com>
+
+        Increase NumberToStringBuffer to account for negative number
+        https://bugs.webkit.org/show_bug.cgi?id=226014
+
+        Reviewed by Robin Morisset.
+
+        In r250389, NumberToStringBuffer length was increased from 96 to 123 because:
+
+        <21 digits> + decimal point + <100 digits> + null char = 123.
+
+        however,
+
+        a = -100000000000000000000
+        a.toFixed(100)
+
+        is a valid conversion and it is 124 chars long, because of the "-" sign.
+
+        So this patch increases the length of NumberToStringBuffer to 124 and adds new
+        test cases.
+
+        * js/dom/number-tofixed-expected.txt:
+        * js/dom/script-tests/number-tofixed.js:
+        * js/kde/Number-expected.txt:
+        * js/kde/script-tests/Number.js:
+
</ins><span class="cx"> 2021-04-27  Frédéric Wang  <fwang@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [MathML] Assertion failure in RenderTreeNeedsLayoutChecker
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit232LayoutTestsjsdomnumbertofixedexpectedtxt"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.32/LayoutTests/js/dom/number-tofixed-expected.txt (282532 => 282533)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.32/LayoutTests/js/dom/number-tofixed-expected.txt    2021-09-16 10:36:22 UTC (rev 282532)
+++ releases/WebKitGTK/webkit-2.32/LayoutTests/js/dom/number-tofixed-expected.txt       2021-09-16 10:36:30 UTC (rev 282533)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> PASS (1234.567).toFixed(20) is "1234.56700000000000727596"
</span><span class="cx"> PASS (1234.567).toFixed(21) is "1234.567000000000007275958"
</span><span class="cx"> PASS (1234.567).toFixed(100) is "1234.5670000000000072759576141834259033203125000000000000000000000000000000000000000000000000000000000000"
</span><ins>+PASS (-100000000000000000000).toFixed(100) is "-100000000000000000000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
</ins><span class="cx"> PASS (1234.567).toFixed(101) threw exception RangeError: toFixed() argument must be between 0 and 100.
</span><span class="cx"> PASS (1234.567).toFixed(-1) threw exception RangeError: toFixed() argument must be between 0 and 100.
</span><span class="cx"> PASS (1234.567).toFixed(-4) threw exception RangeError: toFixed() argument must be between 0 and 100.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit232LayoutTestsjsdomscripttestsnumbertofixedjs"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.32/LayoutTests/js/dom/script-tests/number-tofixed.js (282532 => 282533)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.32/LayoutTests/js/dom/script-tests/number-tofixed.js 2021-09-16 10:36:22 UTC (rev 282532)
+++ releases/WebKitGTK/webkit-2.32/LayoutTests/js/dom/script-tests/number-tofixed.js    2021-09-16 10:36:30 UTC (rev 282533)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> shouldBeEqualToString("(1234.567).toFixed(20)", "1234.56700000000000727596");
</span><span class="cx"> shouldBeEqualToString("(1234.567).toFixed(21)", "1234.567000000000007275958");
</span><span class="cx"> shouldBeEqualToString("(1234.567).toFixed(100)", "1234.5670000000000072759576141834259033203125000000000000000000000000000000000000000000000000000000000000");
</span><ins>+shouldBeEqualToString("(-100000000000000000000).toFixed(100)", "-100000000000000000000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
</ins><span class="cx"> 
</span><span class="cx"> shouldThrow("(1234.567).toFixed(101)");
</span><span class="cx"> shouldThrow("(1234.567).toFixed(-1)");
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit232LayoutTestsjskdeNumberexpectedtxt"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.32/LayoutTests/js/kde/Number-expected.txt (282532 => 282533)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.32/LayoutTests/js/kde/Number-expected.txt    2021-09-16 10:36:22 UTC (rev 282532)
+++ releases/WebKitGTK/webkit-2.32/LayoutTests/js/kde/Number-expected.txt       2021-09-16 10:36:30 UTC (rev 282533)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> PASS Number(NaN).toFixed(7) is "NaN"
</span><span class="cx"> PASS Number(Infinity).toFixed(7) is "Infinity"
</span><span class="cx"> PASS Number(-Infinity).toFixed(7) is "-Infinity"
</span><ins>+PASS Number(-100000000000000000000).toFixed(100) is "-100000000000000000000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
</ins><span class="cx"> PASS Number(Math.pow(10,4)).toFixed(13) is "10000.0000000000000"
</span><span class="cx"> PASS Number(Math.pow(10,17)).toFixed(16) is "100000000000000000.0000000000000000"
</span><span class="cx"> PASS Number(Math.pow(10,18)).toFixed(17) is "1000000000000000000.00000000000000000"
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit232LayoutTestsjskdescripttestsNumberjs"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.32/LayoutTests/js/kde/script-tests/Number.js (282532 => 282533)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.32/LayoutTests/js/kde/script-tests/Number.js 2021-09-16 10:36:22 UTC (rev 282532)
+++ releases/WebKitGTK/webkit-2.32/LayoutTests/js/kde/script-tests/Number.js    2021-09-16 10:36:30 UTC (rev 282533)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> shouldBe("Number(NaN).toFixed(7)","\"NaN\"");
</span><span class="cx"> shouldBe("Number(Infinity).toFixed(7)","\"Infinity\"");
</span><span class="cx"> shouldBe("Number(-Infinity).toFixed(7)","\"-Infinity\"");
</span><ins>+shouldBe("Number(-100000000000000000000).toFixed(100)","\"-100000000000000000000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"");
</ins><span class="cx"> shouldBe("Number(Math.pow(10,4)).toFixed(13)","\"10000.0000000000000\"");
</span><span class="cx"> shouldBe("Number(Math.pow(10,17)).toFixed(16)","\"100000000000000000.0000000000000000\"");
</span><span class="cx"> shouldBe("Number(Math.pow(10,18)).toFixed(17)","\"1000000000000000000.00000000000000000\"");
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit232SourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.32/Source/WTF/ChangeLog (282532 => 282533)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.32/Source/WTF/ChangeLog      2021-09-16 10:36:22 UTC (rev 282532)
+++ releases/WebKitGTK/webkit-2.32/Source/WTF/ChangeLog 2021-09-16 10:36:30 UTC (rev 282533)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2021-05-27  Mikhail R. Gadelha  <mikhail.ramalho@gmail.com>
+
+        Increase NumberToStringBuffer to account for negative number
+        https://bugs.webkit.org/show_bug.cgi?id=226014
+
+        Reviewed by Robin Morisset.
+
+        In r250389, NumberToStringBuffer length was increased from 96 to 123 because:
+
+        <21 digits> + decimal point + <100 digits> + null char = 123.
+
+        however,
+
+        a = -100000000000000000000
+        a.toFixed(100)
+
+        is a valid conversion and it is 124 chars long, because of the "-" sign.
+
+        So this patch increases the length of NumberToStringBuffer to 124 and adds new
+        test cases.
+
+        Reviewed by Ryosuke Niwa.
+
+        * wtf/dtoa.h:
+
</ins><span class="cx"> 2021-05-26  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Hardening] Have the Ref<> destructor null out its pointer
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit232SourceWTFwtfdtoah"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.32/Source/WTF/wtf/dtoa.h (282532 => 282533)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.32/Source/WTF/wtf/dtoa.h     2021-09-16 10:36:22 UTC (rev 282532)
+++ releases/WebKitGTK/webkit-2.32/Source/WTF/wtf/dtoa.h        2021-09-16 10:36:30 UTC (rev 282533)
</span><span class="lines">@@ -27,7 +27,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><del>-using NumberToStringBuffer = std::array<char, 123>;
</del><ins>+// Only toFixed() can use all the 124 positions. The format is:
+// <-> + <21 digits> + decimal point + <100 digits> + null char = 124.
+using NumberToStringBuffer = std::array<char, 124>;
</ins><span class="cx"> 
</span><span class="cx"> WTF_EXPORT_PRIVATE const char* numberToString(float, NumberToStringBuffer&);
</span><span class="cx"> WTF_EXPORT_PRIVATE const char* numberToFixedPrecisionString(float, unsigned significantFigures, NumberToStringBuffer&, bool truncateTrailingZeros = false);
</span></span></pre>
</div>
</div>

</body>
</html>