Home GnuPG
Diffusion GPGME bbfa7c42337b

python: Fix crash by leaving struct members intact

Description

python: Fix crash by leaving struct members intact

* lang/python/setup.py.in: Copy gpgme.h instead of parsing it.

The python bindings tried to parse deprecated functions
out of gpgme.h. This fails for the current gpgme.h in
that it removes an entire field in the key sig struct (_obsolete_class).
Hence, the fields were off by an int and the bindings accessed struct
members via the wrong offset. That caused python program to crash.
At least on 32bit platforms, the crash can be easily triggered by
accessing key.uids[0].signatures. On 64bit platforms the compiler
probably aligns the struct so that the missing 4 bytes are not noticed.

With this change, the python bindings will expose all functions
that gpgme exposes, including the deprecated ones.

Credits go to Justus Winter for debugging and identying the issue.

  • Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
  • GnuPG-bug-id: T3892

Details

Provenance
4tmuelleAuthored on Feb 20 2018, 5:34 PM
wernerCommitted on Apr 17 2018, 10:20 AM
Parents
rM4bba3b8e2c35: core: Allow for --hidden keyword in OpenPGP recpstrings.
Branches
Unknown
Tags
Unknown
Tasks
T3892: python: Fix crash by leaving struct members intact