Skip to content

Commit

Permalink
fix(Windows): Incorrect pointer cast
Browse files Browse the repository at this point in the history
The `AddressOfFuntions` array are actually 32-bit RVAs, not 16-bit.

The cast should be done to `uint` instead of `ushort`.
This bug is not present in the abstractions branch.

Fixes #36
  • Loading branch information
trungnt2910 authored Dec 15, 2023
1 parent 77dd465 commit a517af1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion MemoryModule/Windows/NativeAssemblyImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ private static bool MemoryFreeLibrary(_MEMORYMODULE* mod)
}

// AddressOfFunctions contains the RVAs to the "real" functions
return (void**)(codeBase + (*((ushort*)(codeBase + exports->AddressOfFunctions + (idx * 4)))));
return (void**)(codeBase + (*((uint*)(codeBase + exports->AddressOfFunctions + (idx * 4)))));
}
#endregion

Expand Down

0 comments on commit a517af1

Please sign in to comment.