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

Default stack size in PE file header changes after writing new assembly #537

Closed
arelath opened this issue Sep 19, 2018 · 3 comments
Closed

Comments

@arelath
Copy link

arelath commented Sep 19, 2018

I noticed this when using fody to rewrite a .net assembly. The assembly was compiled for x64 only. The default stack size is 4MB when targeting x64, but 1 MB otherwise. After rewriting the assemebly, the default stack size changed from 4MB to 1MB. I only noticed this because after using fody to rewrite an assembly, I started getting stack overflow errors.

This information is stored in the PE header of the executable. You can verify and test this using dumpbin (command line utility that comes with visual studio). The command "dumpbin /headers file.exe" will show you the default stack size. You can edit the default stack size using the command "editbin /stack:newsize file.exe"

I assume this is actually a cecil bug and not fody directly since it looks like fody is just using cecil on the back end to rewrite the assembly. If this is really a fody implementation bug, let me know and I'll move it over there.

@jbevain
Copy link
Owner

jbevain commented Sep 19, 2018

Thanks for reporting this. That looks like an easy fix, do you want to give it a try?

@arelath
Copy link
Author

arelath commented Sep 19, 2018

If you have a fix, I'll be happy to test it. It would be nice to remove our workaround for stack size.

@jbevain
Copy link
Owner

jbevain commented Sep 19, 2018

I mean to you feel like submitting a PR to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants