From: Antoine Pitrou Date: Mon, 20 Aug 2012 17:30:46 +0000 (+0200) Subject: Issue #15726: Fix incorrect bounds checking in PyState_FindModule. X-Git-Tag: v3.3.0rc1~58^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75506e8b7cc1b21fd10997e4e5d382c515558fa8;p=thirdparty%2FPython%2Fcpython.git Issue #15726: Fix incorrect bounds checking in PyState_FindModule. Patch by Robin Schreiber. --- diff --git a/Misc/ACKS b/Misc/ACKS index 2e72f22592cd..0d851df31344 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -848,6 +848,7 @@ Ralf Schmitt Michael Schneider Peter Schneider-Kamp Arvin Schnell +Robin Schreiber Chad J. Schroeder Sam Schulenburg Stefan Schwarzer diff --git a/Misc/NEWS b/Misc/NEWS index 857a161536c8..74c168f1c539 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.2.4 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 31b5423d38e4..13923313c0a2 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -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;