Stack overflow in PEAssembly::GetResource() #111537
Labels
area-AssemblyLoader-coreclr
regression-from-last-release
untriaged
New issue has not been triaged by the area owner
I have a tool that "hides" embedded resources within an assembly. The idea is to redirect embedded resources to another assembly, which is loaded within the handler of AppDomain.AssemblyResolve. In this process, the "resource assembly" is loaded from bytes. This approach has worked reliably for years, but recently, I've received several reports from customers about the tool crashing with a stack overflow error.
After extensive testing, I was finally able to reproduce the issue on my test machine running Windows 10 with the latest .NET 9.0 SDK.
While debugging the problem, I discovered something strange. When PEAssembly::GetResource() detects that a resource is located in another assembly, it resolves that assembly and calls PEAssembly::GetResource() again, passing the target assembly as the last parameter. However, instead of searching for the resource in the target assembly, it continues to search in the original assembly, ignoring the last parameter.
This behavior repeats endlessly, ultimately resulting in a stack overflow error.
It appears the issue was introduced in the following commit:
eae1542
The text was updated successfully, but these errors were encountered: