Fixing the number formatting code to only recognize 'R' for double/float. (#22613)
authorTanner Gooding <tagoo@outlook.com>
Fri, 15 Feb 2019 06:24:40 +0000 (22:24 -0800)
committerGitHub <noreply@github.com>
Fri, 15 Feb 2019 06:24:40 +0000 (22:24 -0800)
src/System.Private.CoreLib/shared/System/Number.Formatting.cs

index cd61336..aa6d69f 100644 (file)
@@ -1723,6 +1723,11 @@ namespace System
                 case 'R':
                 case 'r':
                 {
+                    if (number.Kind != NumberBufferKind.FloatingPoint)
+                    {
+                        goto default;
+                    }
+
                     format = (char)(format - ('R' - 'G'));
                     Debug.Assert((format == 'G') || (format == 'g'));
                     goto case 'G';