Fix stack overflow if many objects are fetched. (#237)

* fix stack overflow if many objects are fetched

* fix other stack allocations

* add tests and fix linting

* address stephanie's comments

* fix linting

* fix tests
This commit is contained in:
Philipp Moritz
2017-02-04 16:49:36 -08:00
committed by Robert Nishihara
parent e5a9fc0032
commit ca254b8689
5 changed files with 34 additions and 7 deletions
+5 -2
View File
@@ -320,8 +320,8 @@ static PyObject* retrieve_list(PyObject* self, PyObject* args) {
if (!PyObjectToPlasmaConnection(plasma_conn, &conn)) { return NULL; }
Py_ssize_t num_object_ids = PyList_Size(object_id_list);
object_id object_ids[num_object_ids];
object_buffer object_buffers[num_object_ids];
object_id* object_ids = new object_id[num_object_ids];
object_buffer* object_buffers = new object_buffer[num_object_ids];
for (int i = 0; i < num_object_ids; ++i) {
PyStringToUniqueID(PyList_GetItem(object_id_list, i), &object_ids[i]);
@@ -374,6 +374,9 @@ static PyObject* retrieve_list(PyObject* self, PyObject* args) {
PyList_SetItem(returns, i, t);
}
delete[] object_ids;
delete[] object_buffers;
return returns;
}