New submission from Alexey Izbyshev <izbys...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue34697>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to