From 76f342adf8464a2f096218f563fe2edb6663f6d7 Mon Sep 17 00:00:00 2001 From: Maxwell Jeffress Date: Tue, 17 Mar 2026 18:45:16 +1100 Subject: [PATCH 1/2] Fix buffer sizes --- src/interpreter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interpreter.c b/src/interpreter.c index 10497b1..0418844 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -1183,11 +1183,11 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop char buf[256]; switch (value->type) { case INT: { - snprintf(buf, sizeof(buf) * 256, "%" PRId64, value->data.intVal); + snprintf(buf, sizeof(buf), "%" PRId64, value->data.intVal); break; } case DOUBLE: { - snprintf(buf, sizeof(buf) * 256, "%f", value->data.doubleVal); + snprintf(buf, sizeof(buf), "%f", value->data.doubleVal); break; } case STRING: { From 3f678e0cd7ce3dc7411ee39d4958d526add03427 Mon Sep 17 00:00:00 2001 From: Maxwell Jeffress Date: Tue, 17 Mar 2026 19:45:16 +1100 Subject: [PATCH 2/2] Fix code skipping when using use --- src/interpreter.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/interpreter.c b/src/interpreter.c index 0418844..3706332 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -1913,16 +1913,20 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop GroundProgram program = parseFile(fileContents); free(fileContents); - GroundScope newScope = { - .variables = scope->variables, - .labels = malloc(sizeof(GroundLabel*)), - .isMainScope = false - }; + GroundScope newScope = { + .variables = scope->variables, + .labels = malloc(sizeof(GroundLabel*)), + .isMainScope = false + }; - *newScope.labels = NULL; + *newScope.labels = NULL; + + int ci = currentInstruction; interpretGroundProgram(&program, &newScope); + currentInstruction = ci; + break; }