From 777b15e56ab2bfea7037067270dba4f324aa328d Mon Sep 17 00:00:00 2001 From: crc Date: Tue, 21 Nov 2017 12:20:55 +0000 Subject: [PATCH] rre, repl: quit if attempt to store before address 0 FossilOrigin-Name: ce61c9c18e464240e22f68b50fe17474ef089a67143e4c3d3b615b83baae42f7 --- interfaces/repl.c | 2 +- interfaces/rre.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/repl.c b/interfaces/repl.c index 94df9b9..36672b7 100644 --- a/interfaces/repl.c +++ b/interfaces/repl.c @@ -443,7 +443,7 @@ void inst_fetch() { } void inst_store() { - if (TOS <= IMAGE_SIZE) { + if (TOS <= IMAGE_SIZE && TOS >= 0) { memory[TOS] = NOS; inst_drop(); inst_drop(); diff --git a/interfaces/rre.c b/interfaces/rre.c index 90157a1..f66f2c6 100644 --- a/interfaces/rre.c +++ b/interfaces/rre.c @@ -978,7 +978,7 @@ void inst_fetch() { } void inst_store() { - if (TOS <= IMAGE_SIZE) { + if (TOS <= IMAGE_SIZE && TOS >= 0) { memory[TOS] = NOS; inst_drop(); inst_drop();