Skip to content

Commit 7646b10

Browse files
Limit executor growth
1 parent 2873c31 commit 7646b10

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Python/optimizer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ get_index_for_executor(PyCodeObject *code, _Py_CODEUNIT *instr)
7272
}
7373
assert(size <= capacity);
7474
if (size == capacity) {
75+
if (capacity * 2 >= MAX_EXECUTORS_SIZE) {
76+
return -1;
77+
}
7578
/* Array is full. Grow array */
7679
int new_capacity = capacity ? capacity * 2 : 4;
7780
_PyExecutorArray *new = PyMem_Realloc(

0 commit comments

Comments
 (0)