Skip to content

Commit

Permalink
Fix EH stacktrace keepalive array copy size (#104912)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
janvorli authored Jul 16, 2024
1 parent 31733b9 commit bc9b3b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/coreclr/vm/excep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2975,7 +2975,7 @@ void StackTraceInfo::EnsureKeepAliveArray(PTRARRAYREF *ppKeepAliveArray, size_t
{
memmoveGCRefs(pNewKeepAliveArray->GetDataPtr(),
(*ppKeepAliveArray)->GetDataPtr(),
neededSize * sizeof(Object *));
(*ppKeepAliveArray)->GetNumComponents() * sizeof(Object *));
}
// Update the keepAlive array
*ppKeepAliveArray = pNewKeepAliveArray;
Expand Down

0 comments on commit bc9b3b6

Please sign in to comment.