diff options
author | Zackery Spytz <zspytz@gmail.com> | 2018-12-20 17:38:52 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-20 17:38:52 (GMT) |
commit | f347c6eb75ca46990cd7ad3efbe02002603d8460 (patch) | |
tree | 744adc5ac41e122e2084d8214cafb4fbc22be2b3 /Modules | |
parent | 3752bc96c0ea1ecf28903cc34cdcd75c658e92ce (diff) | |
download | cpython-f347c6eb75ca46990cd7ad3efbe02002603d8460.zip cpython-f347c6eb75ca46990cd7ad3efbe02002603d8460.tar.gz cpython-f347c6eb75ca46990cd7ad3efbe02002603d8460.tar.bz2 |
bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. (GH-11175) (GH-11249)
(cherry picked from commit 842acaab1376c5c84fd5966bb6070e289880e1ca)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 4 | ||||
-rw-r--r-- | Modules/_io/textio.c | 4 | ||||
-rw-r--r-- | Modules/_sqlite/connection.c | 4 | ||||
-rw-r--r-- | Modules/cjkcodecs/multibytecodec.c | 4 |
4 files changed, 16 insertions, 0 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 9aa252d..8abcd30 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1216,6 +1216,10 @@ CharArray_set_raw(CDataObject *self, PyObject *value) #if (PY_VERSION_HEX >= 0x02060000) Py_buffer view = { 0 }; #endif + if (value == NULL) { + PyErr_SetString(PyExc_AttributeError, "cannot delete attribute"); + return -1; + } if (PyBuffer_Check(value)) { size = Py_TYPE(value)->tp_as_buffer->bf_getreadbuffer(value, 0, (void *)&ptr); if (size < 0) diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 5501da4..12a12f9 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -2593,6 +2593,10 @@ textiowrapper_chunk_size_set(textio *self, PyObject *arg, void *context) { Py_ssize_t n; CHECK_ATTACHED_INT(self); + if (arg == NULL) { + PyErr_SetString(PyExc_AttributeError, "cannot delete attribute"); + return -1; + } n = PyNumber_AsSsize_t(arg, PyExc_TypeError); if (n == -1 && PyErr_Occurred()) return -1; diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 585453a..18a6b42 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -1131,6 +1131,10 @@ static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, Py PyObject* begin_statement; char* begin_statement_str; + if (isolation_level == NULL) { + PyErr_SetString(PyExc_AttributeError, "cannot delete attribute"); + return -1; + } Py_XDECREF(self->isolation_level); if (self->begin_statement) { diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index 4b482bf..1ad0ea0 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -138,6 +138,10 @@ codecctx_errors_set(MultibyteStatefulCodecContext *self, PyObject *value, { PyObject *cb; + if (value == NULL) { + PyErr_SetString(PyExc_AttributeError, "cannot delete attribute"); + return -1; + } if (!PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "errors must be a string"); return -1; |