mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
bpo-34435: Add missing NULL check to unicode_encode_ucs1(). (GH-8823)
Reported by Svace static analyzer.
This commit is contained in:
committed by
Serhiy Storchaka
parent
225b055480
commit
74a307d48e
@@ -6813,8 +6813,6 @@ unicode_encode_ucs1(PyObject *unicode,
|
||||
str = _PyBytesWriter_WriteBytes(&writer, str,
|
||||
PyBytes_AS_STRING(rep),
|
||||
PyBytes_GET_SIZE(rep));
|
||||
if (str == NULL)
|
||||
goto onError;
|
||||
}
|
||||
else {
|
||||
assert(PyUnicode_Check(rep));
|
||||
@@ -6836,6 +6834,9 @@ unicode_encode_ucs1(PyObject *unicode,
|
||||
PyUnicode_DATA(rep),
|
||||
PyUnicode_GET_LENGTH(rep));
|
||||
}
|
||||
if (str == NULL)
|
||||
goto onError;
|
||||
|
||||
pos = newpos;
|
||||
Py_CLEAR(rep);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user