Skip to content
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

lib: Add support for loading PE images #442

Open
wants to merge 1 commit into
base: v8.x
Choose a base branch
from

Conversation

48cf
Copy link
Contributor

@48cf 48cf commented Dec 28, 2024

No description provided.

continue;
}

ranges[j].base = *virtual_base + ALIGN_UP(section->VirtualAddress, alignment);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be ALIGN_DOWN?

}

ranges[j].base = *virtual_base + ALIGN_UP(section->VirtualAddress, alignment);
ranges[j].length = ALIGN_UP(section->VirtualSize, alignment);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to add the misalign from the base here before aligning up too.

if (reloc_dir->VirtualAddress != 0) {
IMAGE_BASE_RELOCATION_BLOCK *block = (IMAGE_BASE_RELOCATION_BLOCK *)(*physical_base + reloc_dir->VirtualAddress);

while (block->VirtualAddress != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think this is guaranteed, you should instead use reloc_dir->size and check the offset you are into the section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants