Verified Commit 2c777b99 authored by Camil Staps's avatar Camil Staps 🚀

Allocate 4 extra bytes of heap to make sure instructions like fill_a do not write outside of memory

parent 44a6911a
......@@ -77,7 +77,7 @@ deserialize {graph,descinfo,modules,bytecode} thisexe w
# asp = stack
# bsp = stack + IF_INT_64_OR_32 8 4 * (STACK_SIZE-1)
# csp = stack + IF_INT_64_OR_32 4 2 * STACK_SIZE
# heap = malloc (IF_INT_64_OR_32 8 4 * HEAP_SIZE)
# heap = malloc (IF_INT_64_OR_32 8 4 * (HEAP_SIZE+4))
# ie_settings = build_interpretation_environment
pgm
heap HEAP_SIZE stack STACK_SIZE
......
......@@ -409,7 +409,7 @@ int main(int argc, char **argv) {
heap_size /= sizeof(BC_WORD);
heap_size *= 2; /* Copying garbage collector */
stack = safe_malloc(stack_size * sizeof(BC_WORD));
heap = safe_malloc(heap_size * sizeof(BC_WORD));
heap = safe_malloc((heap_size+4) * sizeof(BC_WORD));
BC_WORD *asp = stack;
BC_WORD *bsp = &stack[stack_size];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment