[New-bugs-announce] [issue32402] Coverity: CID 1426868/1426867: Null pointer dereferences in textio.c

STINNER Victor report at bugs.python.org
Thu Dec 21 15:50:02 EST 2017


New submission from STINNER Victor <victor.stinner at gmail.com>:

The following warning may have been introduced by the commit 507434fd504f3ebc1da72aa77544edc0d73f136e from bpo-15216.

New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)


** CID 1426868:  Null pointer dereferences  (NULL_RETURNS)
/Modules/_io/textio.c: 1251 in textiowrapper_change_encoding()

________________________________________________________________________________________________________
*** CID 1426868:  Null pointer dereferences  (NULL_RETURNS)
/Modules/_io/textio.c: 1251 in textiowrapper_change_encoding()
1245             encoding = self->encoding;
1246             if (errors == Py_None) {
1247                 errors = self->errors;
1248             }
1249         }
1250         else if (errors == Py_None) {
>>>     CID 1426868:  Null pointer dereferences  (NULL_RETURNS)
>>>     Assigning: "errors" = null return value from "_PyUnicode_FromId".
1251             errors = _PyUnicode_FromId(&PyId_strict);
1252         }
1253
1254         const char *c_errors = PyUnicode_AsUTF8(errors);
1255         if (c_errors == NULL) {
1256             return -1;

** CID 1426867:  Null pointer dereferences  (NULL_RETURNS)
/Modules/_io/textio.c: 1153 in _io_TextIOWrapper___init___impl()


________________________________________________________________________________________________________
*** CID 1426867:  Null pointer dereferences  (NULL_RETURNS)
/Modules/_io/textio.c: 1153 in _io_TextIOWrapper___init___impl()
1147         }
1148
1149         /* XXX: Failures beyond this point have the potential to leak elements
1150          * of the partially constructed object (like self->encoding)
1151          */
1152
>>>     CID 1426867:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a null pointer "errors".
1153         Py_INCREF(errors);
1154         self->errors = errors;
1155         self->chunk_size = 8192;
1156         self->line_buffering = line_buffering;
1157         self->write_through = write_through;
1158         if (set_newline(self, newline) < 0) {

----------
components: IO
messages: 308903
nosy: inada.naoki, vstinner
priority: normal
severity: normal
status: open
title: Coverity: CID 1426868/1426867:  Null pointer dereferences in textio.c
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32402>
_______________________________________


More information about the New-bugs-announce mailing list