From ddf0aa0d76934602e8090989863cb283dd2cdf16 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Thu, 31 Jan 2019 22:52:01 -0800 Subject: [PATCH] Fixing a GC hole in Number.BigInteger (dotnet/coreclr#22334) Commit migrated from https://github.com/dotnet/coreclr/commit/a8a05e8c595ae0b9e12333134f38e19acf981be4 --- .../System.Private.CoreLib/src/System/Number.BigInteger.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs b/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs index 1231b55..2d61d53 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs @@ -896,8 +896,11 @@ namespace System if ((exponent & 1) != 0) { // Multiply into the next temporary - ref BigInteger rhs = ref *(BigInteger*)(Unsafe.AsPointer(ref s_Pow10BigNumTable[s_Pow10BigNumTableIndices[index]])); - Multiply(ref lhs, ref rhs, ref product); + fixed (uint* pBigNumEntry = &s_Pow10BigNumTable[s_Pow10BigNumTableIndices[index]]) + { + ref BigInteger rhs = ref *(BigInteger*)(pBigNumEntry); + Multiply(ref lhs, ref rhs, ref product); + } // Swap to the next temporary ref BigInteger temp = ref product; -- 2.7.4