Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow in PEAssembly::GetResource() #111537

Open
ArtemRazin opened this issue Jan 17, 2025 · 1 comment
Open

Stack overflow in PEAssembly::GetResource() #111537

ArtemRazin opened this issue Jan 17, 2025 · 1 comment
Labels
area-AssemblyLoader-coreclr regression-from-last-release untriaged New issue has not been triaged by the area owner

Comments

@ArtemRazin
Copy link

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

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jan 17, 2025
Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-AssemblyLoader-coreclr regression-from-last-release untriaged New issue has not been triaged by the area owner
Projects
Status: No status
Development

No branches or pull requests

2 participants