~ chicken-core (master) a09eb9d12c0d218e3c7683d984bfb2b0009fe2ea
commit a09eb9d12c0d218e3c7683d984bfb2b0009fe2ea
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Tue Sep 1 13:44:40 2026 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Tue Sep 1 13:44:40 2026 +0200
avoid NULL ptr arithmetic
Report and fix by "crzcrz"
diff --git a/runtime.c b/runtime.c
index 0bd4992c..9eee66ff 100644
--- a/runtime.c
+++ b/runtime.c
@@ -3127,7 +3127,7 @@ C_regparm C_word C_scratch_alloc(C_uword size)
{
C_word result;
- if (C_scratchspace_top + size + 2 >= C_scratchspace_limit) {
+ if (C_scratchspace_top == NULL || C_scratchspace_top + size + 2 >= C_scratchspace_limit) {
C_word *new_scratch_start, *new_scratch_top, *new_scratch_limit;
C_uword needed = C_scratch_usage + size + 2,
new_size = nmax(scratchspace_size << 1, 2UL << C_ilen(needed));
Trap