summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-08-20 17:31:52 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-08-20 17:31:52 (GMT)
commit35503c9c1444ef4ee11ec403d7848f0240cacc9e (patch)
treee8c4473faf2b738c3e7c3d4ed7547915b3540cf1
parent66d1eb23d42551f510f27f4610d74442579e98d8 (diff)
parent75506e8b7cc1b21fd10997e4e5d382c515558fa8 (diff)
downloadcpython-35503c9c1444ef4ee11ec403d7848f0240cacc9e.zip
cpython-35503c9c1444ef4ee11ec403d7848f0240cacc9e.tar.gz
cpython-35503c9c1444ef4ee11ec403d7848f0240cacc9e.tar.bz2
Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
Patch by Robin Schreiber.
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/pystate.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 32f79fc..60b7531 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.3.0 Release Candidate 1?
Core and Builtins
-----------------
+- Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
+ Patch by Robin Schreiber.
+
- Issue #15604: Update uses of PyObject_IsTrue() to check for and handle
errors correctly. Patch by Serhiy Storchaka.
diff --git a/Python/pystate.c b/Python/pystate.c
index cf08a2b..8dc570a 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -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;