Closed dureuill closed 2 years ago
The first commit looks good.
The second commit is wrong. This function is only intended to return the number of bytes of data that are actually in the file data, even if the virtual size is larger than that.
The problem you are seeing with the exports is in the caller. This code in Export::try_from_ctx
expects that every export address will have a corresponding file offset, but this is not a valid assumption. I think fixing that will require changing Export::offset
to Option<usize>
, which is a breaking change.
I see. Thank you for the answer. I'm not sure how to move forward. Would such a breaking change be possible for goblin?
Meanwhile, I will close this PR, as it is wrong. At least, it prompted your answer :sweat_smile:. The associated issue remains open #291.
I think a breaking change is okay if there is no alternative, and I don't think there is, so feel free to open a PR with that change (or reopen this PR after a force push).
Thank you. As I had already force pushed my branch, GitHub does not let me continue in this PR, so I opened #293.
See the associated issue (#291) for details.
This PR does the following:
min
by amax
so that the section size is at least as big as the virtual size. Note that this deviates from the linked stackexchange post. However, it does fix the associated issue for the tested binaries.Tests
Manual tests with the following test driver (using symbolic, that uses goblin):
On the two tests binaries: libxml2.dll and VBoxMRXNP.dll +
quine.exe
from #101.Compared with
rabin2 -E $PE
.Thank you for your time and consideration!