Browse Source

Issue #15726: Fix incorrect bounds checking in PyState_FindModule.

Patch by Robin Schreiber.
pull/2332/head
Antoine Pitrou 14 years ago
parent
commit
75506e8b7c
  1. 1
      Misc/ACKS
  2. 3
      Misc/NEWS
  3. 2
      Python/pystate.c

1
Misc/ACKS

@ -848,6 +848,7 @@ Ralf Schmitt
Michael Schneider
Peter Schneider-Kamp
Arvin Schnell
Robin Schreiber
Chad J. Schroeder
Sam Schulenburg
Stefan Schwarzer

3
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.

2
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;

Loading…
Cancel
Save