From 10dbb3b42506c964280f5f6d6d43d45ab0a33a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 27 Nov 2021 17:05:14 +0100 Subject: [PATCH] add overrun check to SEE --- src/fh_see.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/fh_see.c b/src/fh_see.c index 9e6b474..28639d9 100644 --- a/src/fh_see.c +++ b/src/fh_see.c @@ -15,6 +15,12 @@ static void show_word(struct fh_thread_s *fh, const struct fh_word_s *w) while (1) { // make sure it's aligned execptr = WORDALIGNED(execptr); + + if (execptr == 0 || execptr > fh->here) { + LOGE("Exec overrun without ENDWORD!"); + break; + } + FHPRINT("0x%08x: ", execptr); const struct fh_instruction_s *instr = fh_instr_at(fh, execptr); if (!instr) {