~ chicken-core (master) 264d1da403b7464b31cd004ec69cb53317c09caa


commit 264d1da403b7464b31cd004ec69cb53317c09caa
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Tue Sep 1 13:55:53 2026 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Tue Sep 1 13:55:53 2026 +0200

    clamp buffer length when construction call chain
    
    Report and fix by "crzcrz"

diff --git a/runtime.c b/runtime.c
index 9eee66ff..4c0c3925 100644
--- a/runtime.c
+++ b/runtime.c
@@ -4524,6 +4524,8 @@ C_word C_fetch_trace(C_word starti, C_word buffer)
     else i = trace_buffer_top - trace_buffer;
 
     ptr = trace_buffer_full ? trace_buffer_top : trace_buffer;
+    if(start < 0) start = 0;
+    if(start > i) start = i;
     ptr += start;
     i -= start;
 
Trap