Skip to content

Commit

Permalink
Fix MethodDesc::CbStackPop for string ctors on x86 (#63391)
Browse files Browse the repository at this point in the history
This method was not taking into account the fact that string ctors
don't have dummy this argument after a recent change. Stack walking
in cases where prestub for the ctor was invoked resulted in a wrong
unwinding of ESP for ctors with more than one argument.

This change fixes it by removing "has this" flag from the signature
before getting the stack arguments size.
  • Loading branch information
janvorli authored Jan 5, 2022
1 parent 70065c1 commit bd6a64b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/coreclr/vm/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,13 @@ UINT MethodDesc::CbStackPop()
SUPPORTS_DAC;
MetaSig msig(this);
ArgIterator argit(&msig);

bool fCtorOfVariableSizedObject = msig.HasThis() && (GetMethodTable() == g_pStringClass) && IsCtor();
if (fCtorOfVariableSizedObject)
{
msig.ClearHasThis();
}

return argit.CbStackPop();
}
#endif // TARGET_X86
Expand Down

0 comments on commit bd6a64b

Please sign in to comment.