[Python-checkins] cpython (merge 3.2 -> default): Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
antoine.pitrou
python-checkins at python.org
Mon Aug 20 19:38:58 CEST 2012
http://hg.python.org/cpython/rev/7789111afe05
changeset: 78678:7789111afe05
parent: 78675:0a3149b30f20
parent: 78677:b96a4b1e7ecb
user: Antoine Pitrou <solipsis at pitrou.net>
date: Mon Aug 20 19:31:52 2012 +0200
summary:
Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
Patch by Robin Schreiber.
files:
Misc/NEWS | 3 +++
Python/pystate.c | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
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
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -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;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list