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

fix several endianness issues in PE modules #1884

Merged
merged 1 commit into from Mar 22, 2023

Conversation

vthib
Copy link
Contributor

@vthib vthib commented Feb 26, 2023

Those were all bugs affecting big-endian architectures:

  • The length field in resources string was read without endianness correction, leading to the name_string, language_string and type_string in pe.resources[*] not being properly set.
  • pe.size_of_optional_header was not using the right size for endianness correction.
  • pe.opthdr_magic was not using the right size for endianness correction.
  • pe.dll_characteristics was read without endianness correction.
  • pe.data_directories was not correctly filled at all, due to not using the right size for endianness correction when reading NumberOfRvaAndSizes.
  • The entrypoint operator was not returning the right value, as the VirtualSize field was read without endianness correction. This operator is deprecated, but the fix is very trivial.

Those were all bugs affecting big-endian architectures:

- The length field in resources string was read without endianness
  correction, leading to the `name_string`, `language_string` and
  `type_string` in `pe.resources[*]` not being properly set.
- `pe.size_of_optional_header` was not using the right size for
  endianness correction.
- `pe.opthdr_magic` was not using the right size for endianness
  correction.
- `pe.dll_characteristics` was not using the right size for endianness
  correction.
- `pe.data_directories` was not correctly filled at all, due to not
  using the right size for endianness correction when reading
  `NumberOfRvaAndSizes`.
- The `entrypoint` operator was not returning the right value, as the
  VirtualSize field was read without endianness correction. This
  operator is deprecated, but the fix is very trivial.
@plusvic plusvic merged commit cebb29a into VirusTotal:master Mar 22, 2023
@vthib vthib deleted the fix-endianness-issues branch March 22, 2023 08:30
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.

None yet

2 participants