about summary refs log tree commit diff
path: root/dynamic.e
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-09-18 00:59:54 -0700
committerIrene Knapp <ireneista@irenes.space>2026-09-18 00:59:54 -0700
commit9c1526c3ccc5371a4bc6142f0ccf5579c7c28e98 (patch)
tree9cf986bc8672dfa6e6c20a87fb4ae3b1c09f5ddc /dynamic.e
parentff945784350416e45aa0d2639684b9f57d6a1c48 (diff)
better behavior in the crash handler when the dictionary is messed up
a lot more defensive bounds checks

Force-Push: yes
Change-Id: Ib900471b8befe06dfa7994714b94ab4ebdc3f0fa
Diffstat (limited to 'dynamic.e')
-rw-r--r--dynamic.e8
1 files changed, 6 insertions, 2 deletions
diff --git a/dynamic.e b/dynamic.e
index d792137..cf27eb5 100644
--- a/dynamic.e
+++ b/dynamic.e
@@ -81,7 +81,7 @@
 ~ (pointer -- entry pointer or 0)
 : containing-entry
   dup is-in-log { drop 0 exit } unless
-  latest @ { dup { 2dup > } { 0 } if-else }
+  latest @ { dup { 2dup > over is-in-log && } { 0 } if-else }
     { @ } while swap drop ;
 
 ~ (entry pointer -- boolean)
@@ -238,7 +238,7 @@
 
 : symbolize-pointer
   dup is-in-log {
-    dup containing-entry dup {
+    dup containing-entry dup is-in-log {
       ~   Any format we're going to use here starts with the entry's name; by
       ~ printing it now we don't have to keep track of it later.
       dup entry-to-name emitstring
@@ -280,6 +280,10 @@
 
 
 : list-callers
+  control@ r0 @ <
+  control@ log @ > ||
+  { ." control stack pointer out of range: " control@ .hex64 newline } if
+
   control@ { dup r0 @ > }
   { dup @ symbolize-pointer newline 8 + } while
   drop ;