Fixing a GC hole in Number.BigInteger (dotnet/coreclr#22334)
authorTanner Gooding <tagoo@outlook.com>
Fri, 1 Feb 2019 06:52:01 +0000 (22:52 -0800)
committerJan Kotas <jkotas@microsoft.com>
Fri, 1 Feb 2019 06:52:01 +0000 (22:52 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/a8a05e8c595ae0b9e12333134f38e19acf981be4

src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs

index 1231b55..2d61d53 100644 (file)
@@ -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;