Mercurial > cpython-lru_cache-weakref
diff Python/pystate.c @ 78677:b96a4b1e7ecb 3.2
Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
Patch by Robin Schreiber.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Mon, 20 Aug 2012 19:30:46 +0200 |
| parents | 49f52d14b65c |
| children | 7789111afe05 e72cda3f40a2 |
line wrap: on
line diff
--- a/Python/pystate.c Mon Aug 20 17:19:50 2012 +0200 +++ b/Python/pystate.c Mon Aug 20 19:30:46 2012 +0200 @@ -248,7 +248,7 @@ 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;
