[issue26628] Undefined behavior calling C functions with ctypes.Union arguments
Thomas
report at bugs.python.org
Tue Apr 5 06:40:32 EDT 2016
Thomas added the comment:
Thanks Eryk for the additional explanation. I added a more elaborate example that doesn't abuse the standard c function that actually doesn't expect a union:
% gcc -shared -fPIC libfoo.c -o libfoo.so -Wall
% python pyfoo.py
*** stack smashing detected ***: python terminated
[1] 28463 segmentation fault (core dumped) python pyfoo.py
The underling issue is exactly the same as previously described.
I still argue that ctypes should refuse to attempt such a call, and the documentation should be clarified, as long as libffi does not support unions.
----------
Added file: http://bugs.python.org/file42373/pyfoo.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26628>
_______________________________________
More information about the Python-bugs-list
mailing list