[issue11048] "import ctypes" causes segfault on read-only filesystem

STINNER Victor report at bugs.python.org
Wed Jul 27 11:07:59 EDT 2016


STINNER Victor added the comment:

Sorry, I'm unable to reproduce the crash using the read-only filesystem. But an assertion confirmed me that the restype is not initialized which is an obvious bug.


ctypes-erofs-crash.diff: LGTM. By the way, the flags field is not initialized neither, but it's probably less important (at least for the destructor).


Alexander Belopolsky: "It would be nice to add a unit test to this patch."

I tried to write a short unit test triggering the bug, but it really depends on low-level implementation details for a very specific corner case. I would prefer to avoid such complex unit test and just fix the bug. We waited for an unit test the last 5 years, it's too late now :-)


"A nit-pick: it would be easier to verify that all CThunkObject fields are initialized if initialization was done in the same order as declaration:"

Right, I rewrote the patch as you suggested. I noticed that flags is not initialized neither (also fixed in my patch).


I pushed a fix.


Thanks marcin.bachry for the initial patch! Thanks Pavel Labushev for your bug report! ... but sorry for the very long delay :-( It looks like nobody reproduced the bug recently, maybe it was fixed in libffi in the meanwhile?

----------
nosy: +haypo
resolution:  -> fixed
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11048>
_______________________________________


More information about the Python-bugs-list mailing list