Skip to content

Endian support for ELF parsing #166

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

Closed
wants to merge 8 commits into from

Conversation

wb-airbus
Copy link
Contributor

@wb-airbus wb-airbus commented May 8, 2018

This pull requests allows lief to parse ELF binaries with a foreign-endian encoding. It also adds a little fix to how Note sections in ELFs are parsed (read in as 4 byte words) so that foreign-endian instances retain the expected values.

wb-airbus added 5 commits May 8, 2018 14:10
Previous implementation read byte-by-byte which
lead to incorrect values for BigEndian binaries.
Native-endian arrays were not properly initialized.
@wb-airbus
Copy link
Contributor Author

wb-airbus commented May 8, 2018

Should be ok now. My sample ELFs, both BE and LE, are being parsed fine.

@romainthomas
Copy link
Member

Hum, CI still fail.

wb-airbus added 2 commits May 11, 2018 09:58
Fixed an inverted test condition when parsing Gnu Hash ELF notes.
@wb-airbus
Copy link
Contributor Author

I figured out how to get the unit tests running on my machine and observed two problems:

  • Failed ELF_PYTHON_test_dynamic: as I understand things this one involves renaming a dynamic library and altering a binary to use the new name. I couldn't really see where my modifications could have an impact, so I just checked out the upstream branch (commit id e7c45a1) and try to run the test against it. As it turns out the test failed against this branch too (at least when run on my machine). So there might be an issue lurking elsewhere.
  • Failed FUZZER_ELF_bin_ls_x86 & FUZZER_ELF_bin_nm_x86: these are Melkor fuzz tests that are indeed failing. I still need to debug one of the crash-inducing samples to see if I can figure out what was broken in _pylief.so.

@romainthomas
Copy link
Member

Looks good :) I'll do a deep review next week, Thanks!

@romainthomas romainthomas self-requested a review May 12, 2018 13:07
@romainthomas
Copy link
Member

I almost finished the review. It will be merged by the end of the day.

@wb-airbus
Copy link
Contributor Author

Sweet, thanks!

@romainthomas
Copy link
Member

Merged with e794ac1

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