From e342d9b254bd2b70844d47d32cee5c7f720bf111 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Mon, 29 Aug 2022 12:01:08 -0400 Subject: [PATCH] Fixed poking segfault Machine would segfault when poking address 0 on an uninitialized block. this has been fixed. --- creature.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/creature.go b/creature.go index 85cc0f6..d92c031 100644 --- a/creature.go +++ b/creature.go @@ -263,7 +263,7 @@ func (machine *Machine[WORD]) Peek(address WORD) (word WORD) { // Poke sets the value at address in the block to word. func (machine *Machine[WORD]) Poke(address WORD, word WORD) { if int(address) >= len(machine.block) { - reallocatedBlock := make([]WORD, address*3/2) + reallocatedBlock := make([]WORD, address*3/2+1) copy(reallocatedBlock, machine.block) machine.block = reallocatedBlock }