mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
Patch by Robin Schreiber.
This commit is contained in:
commit
35503c9c14
2 changed files with 4 additions and 1 deletions
|
@ -248,7 +248,7 @@ PyState_FindModule(struct PyModuleDef* module)
|
|||
return NULL;
|
||||
if (state->modules_by_index == NULL)
|
||||
return NULL;
|
||||
if (index > PyList_GET_SIZE(state->modules_by_index))
|
||||
if (index >= PyList_GET_SIZE(state->modules_by_index))
|
||||
return NULL;
|
||||
res = PyList_GET_ITEM(state->modules_by_index, index);
|
||||
return res==Py_None ? NULL : res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue