Index: src/_apachemodule.c =================================================================== --- src/_apachemodule.c (revision 178803) +++ src/_apachemodule.c (working copy) @@ -380,6 +380,14 @@ apr_pool_userdata_get((void **)&glb, MP_CONFIG_KEY, s->process->pool); + if ((index >= (glb->nlocks)) || (index < -1)) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, + "Index %d is out of range for number of global mutex locks", index); + PyErr_SetString(PyExc_ValueError, + "Lock index is out of range for number of global mutex locks"); + return NULL; + } + if (index == -1) { int hash = PyObject_Hash(key); @@ -446,7 +454,15 @@ apr_pool_userdata_get((void **)&glb, MP_CONFIG_KEY, s->process->pool); - + + if ((index >= (glb->nlocks)) || (index < -1)) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, + "Index %d is out of range for number of global mutex locks", index); + PyErr_SetString(PyExc_ValueError, + "Lock index is out of range for number of global mutex locks"); + return NULL; + } + if (index == -1) { int hash = PyObject_Hash(key); @@ -521,7 +537,15 @@ apr_pool_userdata_get((void **)&glb, MP_CONFIG_KEY, s->process->pool); - + + if ((index >= (glb->nlocks)) || (index < -1)) { + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, + "Index %d is out of range for number of global mutex locks", index); + PyErr_SetString(PyExc_ValueError, + "Lock index is out of range for number of global mutex locks"); + return NULL; + } + if (index == -1) { int hash = PyObject_Hash(key);