-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Fix swapped args in AssemblySpec::AssemblyNameInit #50148
Fix swapped args in AssemblySpec::AssemblyNameInit #50148
Conversation
GetPEKindAndMachine takes two arguments, a kind and a machine, in that order: $ ag GetPEKindAndMachine ... src/coreclr/vm/pefile.cpp 181: peFile->GetPEKindAndMachine(&peKind, &actualMachineType); 1688:void PEFile::GetPEKindAndMachine(DWORD* pdwKind, DWORD* pdwMachine) 1723: GetILimage()->GetPEKindAndMachine(pdwKind, pdwMachine); src/coreclr/vm/peimage.h 383: void GetPEKindAndMachine(DWORD* pdwKind, DWORD* pdwMachine); ... But this code swaps the arguments: pImageInfo->GetPEKindAndMachine(&dwMachine,&dwKind); Fix that.
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @vitek-karas, @agocke, @CoffeeFlux, @VSadov Issue DetailsGetPEKindAndMachine takes two arguments, a kind and a machine, in that order:
But this code swaps the arguments:
Fix that.
|
@@ -564,7 +564,7 @@ void AssemblySpec::AssemblyNameInit(ASSEMBLYNAMEREF* pAsmName, PEImage* pImageIn | |||
{ | |||
DWORD dwMachine, dwKind; | |||
|
|||
pImageInfo->GetPEKindAndMachine(&dwMachine,&dwKind); | |||
pImageInfo->GetPEKindAndMachine(&dwKind, &dwMachine); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The names of the local variables are swapped, but they're also swapped below when used to call the AssemblyName.SetProcArchIndex
. So in the end the right values are passed in. It would be great if you could simply swap the variables in both places so that the names match the meaning.
This also means that there's no test for this (it should have failed with your change). It would be great if you could add a test for this. Probably somewhere around here: https://github.com/dotnet/runtime/tree/main/src/tests/Loader/binding/assemblies/basicapi/assemblynamector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Great to know that this isn't an actual bug. I am blocked by #50175 for a test. Once I have that sorted out, I will update this PR.
@omajid Any update? Sorry, you may have to use Ubuntu (or an Ubuntu docker image) since we don't have an officially supported Fedora workflow. |
Sorry, didn't get a chance to look into this any further. I will try and find some time this week. |
No worries -- if you want to close this PR and come back to it later when you have time, we'll be happy to help then. |
Closing for now to clean up queries. Feel free to re-open when the changes are ready |
GetPEKindAndMachine takes two arguments, a kind and a machine, in that order:
But this code swaps the arguments:
Fix that.