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

section_from_rva can't find section on a PE file #914

Open
canassa opened this issue May 9, 2023 · 3 comments
Open

section_from_rva can't find section on a PE file #914

canassa opened this issue May 9, 2023 · 3 comments
Assignees
Labels

Comments

@canassa
Copy link

canassa commented May 9, 2023

Describe the bug
I am quite sure this is a problem with me not knowing how to use the library, but let me describe the issue.

section_from_rva() function returns None when trying to retrieve a section by its RVA. This issue is encountered when working with the LIEF library for patching a PE file

To Reproduce

binary = lief.parse("PLAGUE.EXE")
binary.patch_address(0x0045240F, [0x90])
>> Can't find section with the rva: 0x5240f

This is decompiled function that I am trying to patch:
image

The issue seems to be related to section_from_rva not finding the section:

sec = binary.sections[0]
binary.section_from_rva(sec.virtual_address)
>> None

Environment (please complete the following information):

  • System and Version: OSX
  • LIEF commit version: 0.13.0-966a66c7
@romainthomas
Copy link
Member

Can you attach the binary?

@canassa
Copy link
Author

canassa commented May 10, 2023

Thanks for the quick response!

Sure, here it is:

PLAGUE.EXE.zip

@romainthomas
Copy link
Member

All the virtual sizes of all the sections are 0 thus, LIEF can't determine in which section a RVA belongs to.
I would say this is the expected behavior.

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

No branches or pull requests

2 participants