retitle 884705 python3-cffi-backend: does not handle pointers on ILP32 ABIs 
correctly
reassign 884705 python3-cffi-backend
found 884705 1.11.5-1+b1
affects 884705 src:python-cryptography
# remove those, as they were for python-cryptography
notforwarded 884705
tags 884705 = patch
thanks

Please see the following thread (former forwarded-to) for more debugging:
https://github.com/pyca/cryptography/issues/4078

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 forward this upstream and apply it in Debian, to make
packages that use cffi work reliably on x32.

Thanks,
//mirabilos
-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -5636,6 +5636,7 @@ static int convert_from_object_fficallba
             return 0;
         }
         else if (ctype->ct_flags & (CT_PRIMITIVE_CHAR | CT_PRIMITIVE_SIGNED |
+                                    CT_POINTER | CT_FUNCTIONPTR |
                                     CT_PRIMITIVE_UNSIGNED)) {
             /* zero extension: fill the '*result' with zeros, and (on big-
                endian machines) correct the 'result' pointer to write to */

Reply via email to