does not handle pointers on ILP32 ABIs correctly

Create issue
Issue #372 resolved
Former user created an issue

Please see the following thread for more debugging:

I discovered that cffi’s mechanism to zero- or sign-extend values smaller than the CPU register size (ffi_arg) was only applied to signed or unsigned integer values but not pointers, whereas the x86-64 (amd64 and x32) ELF psABI specifies that 32-bit pointers passed in 64-bit registers must be zero-padded.

Some architectures might require sign-padding them instead, but considering that x32 appears to be the first one actually running into this issue I’d default to zero-pad them on all architectures. The extra code path will only ever be triggered on 64-bit ILP32 architectures, which are basically all new (unless MIPS n32 was one of them, but I don’t think so, or they’d have been hit from this bug).

Please apply the patch in your next releases, to make packages that use cffi work reliably on x32.


Comments (1)

  1. Log in to comment