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 ELF Parser size bug and Re-enable test_elf_*.py tests for Windows #26

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

jptomoya
Copy link
Contributor

@jptomoya jptomoya commented Feb 20, 2024

Fix ELF Parser size bug and Re-enable test_elf_*.py tests for Windows

What's this Pull Request for?

Choose one or more of the following items.

  • Bug fix
  • Add/Remove feature
  • Cleaning code (including optimization/typo fix)
  • Others

Please explain the detail here:
This pull request fixes an ELF parser size bug, which was causing some test_elf_*.py tests to fail. It does so by using implementation-independent integer types in BunkaiPrimitive. And also reverts the test_elf_*.py tests for Windows.

The root cause of this issue is the difference in the sizeof types like long across different platforms:

On x64 Windows 11:

Python 3.12.2 (tags/v3.12.2:6abddd9, Feb  6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.sizeof(ctypes.c_ulong)
4

On x64 Ubuntu:

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.sizeof(ctypes.c_ulong)
8

What have you done so far?

Tell me what you've tested to assure your change is right.

  • All tests passed on your machine (python -m unittest)
  • Added test cases for new feature
  • Nothing / Test not required

(It's not mandatory to check even one of them, but test cases make it easy for the author to review your PR.)

Comment

@ptr-yudai
Copy link
Owner

Thanks for the PR!

@ptr-yudai ptr-yudai merged commit 4fc35fe into ptr-yudai:master Feb 21, 2024
10 checks passed
@jptomoya jptomoya deleted the fix-elf-parser branch February 21, 2024 14:25
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