Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit a8a05e8

Browse files
tannergoodingjkotas
authored andcommitted
Fixing a GC hole in Number.BigInteger (#22334)
1 parent c648dc7 commit a8a05e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,11 @@ public static void Pow10(uint exponent, out BigInteger result)
896896
if ((exponent & 1) != 0)
897897
{
898898
// Multiply into the next temporary
899-
ref BigInteger rhs = ref *(BigInteger*)(Unsafe.AsPointer(ref s_Pow10BigNumTable[s_Pow10BigNumTableIndices[index]]));
900-
Multiply(ref lhs, ref rhs, ref product);
899+
fixed (uint* pBigNumEntry = &s_Pow10BigNumTable[s_Pow10BigNumTableIndices[index]])
900+
{
901+
ref BigInteger rhs = ref *(BigInteger*)(pBigNumEntry);
902+
Multiply(ref lhs, ref rhs, ref product);
903+
}
901904

902905
// Swap to the next temporary
903906
ref BigInteger temp = ref product;

0 commit comments

Comments
 (0)