Commit 845f7845 authored by Brett Cannon's avatar Brett Cannon

Issue #18556: Check the return value for PyUnicode_AsWideChar() in

U_set() from ctypes.

CID #486657
parent b76b1b1e
...@@ -52,6 +52,9 @@ Core and Builtins ...@@ -52,6 +52,9 @@ Core and Builtins
Library Library
------- -------
- Issue #18556: Check the return value of a PyUnicode_AsWideChar() call in
ctypes' U_set().
- Issue #18549: Eliminate dead code in socket_ntohl() - Issue #18549: Eliminate dead code in socket_ntohl()
- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() - Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
......
...@@ -1260,7 +1260,11 @@ U_set(void *ptr, PyObject *value, Py_ssize_t length) ...@@ -1260,7 +1260,11 @@ U_set(void *ptr, PyObject *value, Py_ssize_t length)
} else if (size < length-1) } else if (size < length-1)
/* copy terminating NUL character if there is space */ /* copy terminating NUL character if there is space */
size += 1; size += 1;
PyUnicode_AsWideChar(value, (wchar_t *)ptr, size);
if (PyUnicode_AsWideChar(value, (wchar_t *)ptr, size) == -1) {
return NULL;
}
return value; return value;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment