Commit 121adebf authored by floitschV8@gmail.com's avatar floitschV8@gmail.com

Fix strtod.

Strtod function used buffer that was allocated inside a nested scope.

Review URL: http://codereview.chromium.org/4639006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5815 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7fac48cc
......@@ -422,9 +422,9 @@ double Strtod(Vector<const char> buffer, int exponent) {
int significant_exponent;
TrimToMaxSignificantDigits(trimmed, exponent,
significant_buffer, &significant_exponent);
trimmed =
Vector<const char>(significant_buffer, kMaxSignificantDecimalDigits);
exponent = significant_exponent;
return Strtod(Vector<const char>(significant_buffer,
kMaxSignificantDecimalDigits),
significant_exponent);
}
if (exponent + trimmed.length() - 1 >= kMaxDecimalPower) return V8_INFINITY;
if (exponent + trimmed.length() <= kMinDecimalPower) return 0.0;
......
......@@ -259,6 +259,23 @@ TEST(Strtod) {
CHECK_EQ(1234567890123456789052345e115,
StrtodChar("1234567890123456789052345", 115));
CHECK_EQ(5.445618932859895e-255,
StrtodChar("5445618932859895362967233318697132813618813095743952975"
"4392982234069699615600475529427176366709107287468930197"
"8628345413991790019316974825934906752493984055268219809"
"5012176093045431437495773903922425632551857520884625114"
"6241265881735209066709685420744388526014389929047617597"
"0302268848374508109029268898695825171158085457567481507"
"4162979705098246243690189880319928315307816832576838178"
"2563074014542859888710209237525873301724479666744537857"
"9026553346649664045621387124193095870305991178772256504"
"4368663670643970181259143319016472430928902201239474588"
"1392338901353291306607057623202353588698746085415097902"
"6640064319118728664842287477491068264828851624402189317"
"2769161449825765517353755844373640588822904791244190695"
"2998382932630754670573838138825217065450843010498555058"
"88186560731", -1035));
// Boundary cases. Boundaries themselves should round to even.
//
// 0x1FFFFFFFFFFFF * 2^3 = 72057594037927928
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment