diff options
author | scoder <stefan_ml@behnel.de> | 2023-10-30 11:24:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-30 11:24:21 (GMT) |
commit | 940ee962a8a1e87543fd36338228e526e7f35067 (patch) | |
tree | 668ee5f5f4daf1b07b2990b2c07d597a6960ff67 /Include/cpython | |
parent | 4a929d432b48775096d40f5c72bcd9be052b0a2d (diff) | |
download | cpython-940ee962a8a1e87543fd36338228e526e7f35067.zip cpython-940ee962a8a1e87543fd36338228e526e7f35067.tar.gz cpython-940ee962a8a1e87543fd36338228e526e7f35067.tar.bz2 |
gh-106168: Check allocated instead of size index bounds in PyList_SET_ITEM() (#111480)
Check the index bound assertions in PyList_SET_ITEM() against [0:allocated] instead of [0:size] to re-allow valid use cases that assign within the allocated area.
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/listobject.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/cpython/listobject.h b/Include/cpython/listobject.h index 6616105..c4d9052 100644 --- a/Include/cpython/listobject.h +++ b/Include/cpython/listobject.h @@ -39,7 +39,7 @@ static inline void PyList_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) { PyListObject *list = _PyList_CAST(op); assert(0 <= index); - assert(index < Py_SIZE(list)); + assert(index < list->allocated); list->ob_item[index] = value; } #define PyList_SET_ITEM(op, index, value) \ |