There was an error while loading. Please reload this page.
1 parent 3252205 commit 041a4eeCopy full SHA for 041a4ee
1 file changed
Modules/_bsddb.c
@@ -2257,7 +2257,7 @@ static PyObject*
2257
DB_join(DBObject* self, PyObject* args)
2258
{
2259
int err, flags=0;
2260
- int length, x;
+ Py_ssize_t length, x;
2261
PyObject* cursorsObj;
2262
DBC** cursors;
2263
DBC* dbc;
@@ -2274,6 +2274,12 @@ DB_join(DBObject* self, PyObject* args)
2274
}
2275
2276
length = PyObject_Length(cursorsObj);
2277
+ if (length == -1) {
2278
+ return NULL;
2279
+ }
2280
+ if (length >= PY_SSIZE_T_MAX / sizeof(DBC*)) {
2281
+ return PyErr_NoMemory();
2282
2283
cursors = malloc((length+1) * sizeof(DBC*));
2284
if (!cursors) {
2285
PyErr_NoMemory();
0 commit comments