Fix "Offset" values in Optional Header metadata #2135
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Offset values in the "Optional Header" metadata section are missing the base offset and thus start at 00000000 instead of at something like 00000098. This concerns lines 65 - 94:
https://github.com/icsharpcode/ILSpy/blob/master/ILSpy/Metadata/OptionalHeaderTreeNode.cs#L65-L94
Solution
I applied the base offset,
headers.PEHeaderStartOffset
, in the same manner that it's being applied in CoffHeaderTreeNode.cs (lines 70 - 75):https://github.com/icsharpcode/ILSpy/blob/master/ILSpy/Metadata/CoffHeaderTreeNode.cs#L70-L75
NOTE: I apologize that I have no ability to test this change. However, it should be very low-risk as no new lines are being added, it's an existing variable, and it's being handled consistently with the other metadata section that has a similar base offset. However, if a change needs to be made then please let me know.
Take care,
Solomon...
https://SqlQuantumLeap.com/