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.
Hi
This pull request fixes the issue (#517).
The current implementation of
build_import_table
does not check the correspondence between the imported functions and the trampolines. So, if we add an import function entry byadd_entry
and build IAT by callingbuild_import_table
, its correspondence is shifted back one by one.I illustrate this situation.
Before adding a new import entry, the correspondence between IAT and trampolines is correct.
However, after adding
wcsrchr
(illustrated by orange color), its correspondence is incorrect. In this case, when we try to callputs
function,_cexit
function is called instead.To fix this issue, I added a new member
manually_added_
toImportEntry
class to distinguish whether the entry is manually added or not. If the entry is a manually-added one, linking between the original IAT entry and the trampoline is skipped.