From 9fe9334538ebe34307dd24c7ca890f4430fb7f12 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Fri, 23 Mar 2018 21:57:45 +0100 Subject: [PATCH] fix rounding error in ecl_stack_set_size The size of the arguments stack would grow quadratically, instead of being rounded to the nearest bigger page size. --- src/c/interpreter.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/interpreter.d b/src/c/interpreter.d index d937fdbab..74f510584 100644 --- a/src/c/interpreter.d +++ b/src/c/interpreter.d @@ -30,7 +30,7 @@ ecl_stack_set_size(cl_env_ptr env, cl_index tentative_new_size) cl_index new_size = tentative_new_size + 2*safety_area; /* Round to page size */ - new_size = (new_size + (LISP_PAGESIZE-1))/LISP_PAGESIZE * new_size; + new_size = ((new_size + LISP_PAGESIZE - 1) / LISP_PAGESIZE) * LISP_PAGESIZE; if (ecl_unlikely(top > new_size)) { FEerror("Internal error: cannot shrink stack below stack top.",0);