Issue #15726: Fix incorrect bounds checking in PyState_FindModule.

Patch by Robin Schreiber.
This commit is contained in:
Antoine Pitrou 2012-08-20 19:30:46 +02:00
parent 07795df683
commit 75506e8b7c
3 changed files with 5 additions and 1 deletions

View file

@ -248,7 +248,7 @@ PyState_FindModule(struct PyModuleDef* m)
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;