Skip to content

Commit bc9b3b6

Browse files
authored
Fix EH stacktrace keepalive array copy size (#104912)
When the stacktrace keepalive array is grown, we were incorrectly copying extra item from the original keepalive array to the new one. In some cases, it ended up adding garbage to the array and GC object verification has hickuped on it. In the CI, it was only hit by GCStress-Extra tests that set DOTNET_HeapVerify=1 so far. This fixes the copied size to be the source array's number of elements. Close #104878
1 parent 31733b9 commit bc9b3b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/coreclr/vm/excep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2975,7 +2975,7 @@ void StackTraceInfo::EnsureKeepAliveArray(PTRARRAYREF *ppKeepAliveArray, size_t
29752975
{
29762976
memmoveGCRefs(pNewKeepAliveArray->GetDataPtr(),
29772977
(*ppKeepAliveArray)->GetDataPtr(),
2978-
neededSize * sizeof(Object *));
2978+
(*ppKeepAliveArray)->GetNumComponents() * sizeof(Object *));
29792979
}
29802980
// Update the keepAlive array
29812981
*ppKeepAliveArray = pNewKeepAliveArray;

0 commit comments

Comments
 (0)