Home GnuPG

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
rGPGMEPY58d8494608b2: Merge branch 'master' of ssh+git://playfair.gnupg.org/git/gpgme
Branches
Unknown
Tags
Unknown

Event Timeline