Bug 1451908 - Check for infinite value in txFormatNumberFunctionCall. r=peterv
authorEric Rahm <erahm@mozilla.com>
Tue, 17 Apr 2018 11:22:04 -0700
changeset 469021 e47d7dbc1cd289086eb63c24cce1600c2b5329c7
parent 469020 40e0bf2538b950377ecd07bfbca40208170be79a
child 469022 d3c93907c3edfd9aedcf0187cae127fcc1498803
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1451908
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1451908 - Check for infinite value in txFormatNumberFunctionCall. r=peterv
dom/xslt/xslt/txFormatNumberFunctionCall.cpp
--- a/dom/xslt/xslt/txFormatNumberFunctionCall.cpp
+++ b/dom/xslt/xslt/txFormatNumberFunctionCall.cpp
@@ -260,16 +260,22 @@ txFormatNumberFunctionCall::evaluate(txI
 
     /*
      * FINALLY we're done with the parsing
      * now build the result string
      */
 
     value = fabs(value) * multiplier;
 
+    // Make sure the multiplier didn't push value to infinity.
+    if (value == mozilla::PositiveInfinity<double>()) {
+        return aContext->recycler()->getStringResult(format->mInfinity,
+                                                     aResult);
+    }
+
     // Prefix
     nsAutoString res(prefix);
 
     int bufsize;
     if (value > 1)
         bufsize = (int)log10(value) + 30;
     else
         bufsize = 1 + 30;