[New-bugs-announce] [issue34697] ctypes: Crash if manually-created CField instance is used
Alexey Izbyshev
report at bugs.python.org
Sat Sep 15 13:13:13 EDT 2018
New submission from Alexey Izbyshev <izbyshev at ispras.ru>:
It is possible to manually create an instance of private CField type which is used by ctypes to represent fields of Structure and Union types. This instance will be uninitialized because it's normally initialized when instances of Structure/Union are created, so calling its methods may crash the interpreter:
from ctypes import *
class S(Structure):
_fields_ = [('x', c_int)]
CField = type(S.x)
f = CField()
repr(f) # Crash here
Is this issue worth fixing?
If so, is the correct way to set tp_new slot to NULL and fix the internal callers so that users wouldn't be able to create CField instances?
----------
components: ctypes
messages: 325448
nosy: amaury.forgeotdarc, belopolsky, berker.peksag, izbyshev, meador.inge, serhiy.storchaka
priority: normal
severity: normal
status: open
title: ctypes: Crash if manually-created CField instance is used
type: crash
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34697>
_______________________________________
More information about the New-bugs-announce
mailing list