From: Stephen Toub Date: Wed, 27 Jun 2018 03:30:38 +0000 (-0400) Subject: Fix number formatting exception with empty NumberGroupSizes array (#18221) (#18667) X-Git-Tag: accepted/tizen/5.0/base/20181101.090356~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c6b90e42840050fec597cef53ae7d88695bf678;p=platform%2Fupstream%2Fcoreclr.git Fix number formatting exception with empty NumberGroupSizes array (#18221) (#18667) --- diff --git a/src/mscorlib/shared/System/Number.Formatting.cs b/src/mscorlib/shared/System/Number.Formatting.cs index 74395ab..387fe01 100644 --- a/src/mscorlib/shared/System/Number.Formatting.cs +++ b/src/mscorlib/shared/System/Number.Formatting.cs @@ -1974,13 +1974,14 @@ namespace System if (groupDigits != null) { int groupSizeIndex = 0; // Index into the groupDigits array. - int groupSizeCount = groupDigits[groupSizeIndex]; // The current total of group size. int bufferSize = digPos; // The length of the result buffer string. int groupSize = 0; // The current group size. // Find out the size of the string buffer for the result. if (groupDigits.Length != 0) // You can pass in 0 length arrays { + int groupSizeCount = groupDigits[groupSizeIndex]; // The current total of group size. + while (digPos > groupSizeCount) { groupSize = groupDigits[groupSizeIndex];