summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Parser')
-rw-r--r--src/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Parser/Utf8Parser.Number.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Parser/Utf8Parser.Number.cs b/src/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Parser/Utf8Parser.Number.cs
index daa1da60a8..799a3fe6a7 100644
--- a/src/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Parser/Utf8Parser.Number.cs
+++ b/src/System.Private.CoreLib/shared/System/Buffers/Text/Utf8Parser/Utf8Parser.Number.cs
@@ -303,10 +303,15 @@ namespace System.Buffers.Text
{
if (number.Scale > int.MaxValue - (long)absoluteExponent)
{
- bytesConsumed = 0;
- return false;
+ // A scale overflow means all non-zero digits are all so far to the right of the decimal point, no
+ // number format we have will be able to see them. Just pin the scale at the absolute maximum
+ // and let the converter produce a 0 with the max precision available for that type.
+ number.Scale = int.MaxValue;
+ }
+ else
+ {
+ number.Scale += (int)absoluteExponent;
}
- number.Scale += (int)absoluteExponent;
}
digits[dstIndex] = 0;