commit | 3aee092ecb53b234073028e3870502713b429f12 | [log] [tgz] |
---|---|---|
author | Raymond Hettinger <python@rcn.com> | Mon May 11 20:00:25 2015 -0700 |
committer | Raymond Hettinger <python@rcn.com> | Mon May 11 20:00:25 2015 -0700 |
tree | b30aa272a3660c07c56c15dcd65be48d6d974a7c | |
parent | 632d692e296bfe980e2b1ba233d168135f3de5f4 [diff] |
Defend against a mutation during comparison
diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c index d0ddb09..be301a6 100644 --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c
@@ -244,6 +244,11 @@ return item; } + if (PyList_GET_SIZE(heap) == 0) { + PyErr_SetString(PyExc_IndexError, "index out of range"); + return NULL; + } + returnitem = PyList_GET_ITEM(heap, 0); Py_INCREF(item); PyList_SET_ITEM(heap, 0, item);