Skip to content

Comments

Fix 32-bit/64-bit address space handling#58

Open
nobody-Justheader wants to merge 1 commit intohuntergregal:masterfrom
nobody-Justheader:feature/fix-32bit-64bit-address-space
Open

Fix 32-bit/64-bit address space handling#58
nobody-Justheader wants to merge 1 commit intohuntergregal:masterfrom
nobody-Justheader:feature/fix-32bit-64bit-address-space

Conversation

@nobody-Justheader
Copy link

@nobody-Justheader nobody-Justheader commented Dec 27, 2025

Summary

This PR fixes the documented issue where the 32-bit variant of mimipenguin fails in 64-bit userspace due to inadequate handling of 64-bit address spaces.

Problem

The original code used unsigned long for memory addresses which caused truncation when 32-bit binaries ran in 64-bit userspace with addresses beyond 4GB.

Solution

  • Changed to uint64_t for all memory addresses (guaranteed 64-bit)
  • Updated format specifiers to portable C99 macros (SCNx64, PRIx64)
  • Added explicit (off_t) cast for fseeko() calls

Testing

  • 64-bit build successful
  • 32-bit build successful (tested in Docker i386)
  • Functional tests pass on both architectures
  • No regressions, backward compatible

Impact

Resolves the "Known Issues" limitation documented in README about 32-bit variant failing in 64-bit userspace.

- Changed memory address variables from unsigned long to uint64_t
- Updated format specifiers to use SCNx64/PRIx64 for portability
- Added explicit cast to off_t for fseeko() calls
- Removed known issue from README.md

This fix ensures the 32-bit variant can properly handle 64-bit
memory addresses when running in a 64-bit userspace, resolving
the documented limitation with cross-architecture compatibility.
@SouthHalfCents
Copy link

SouthHalfCents commented Dec 27, 2025 via email

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