From 00dbb67ff654c4d76ef1c3177927bc8eebff6f85 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Mon, 31 Mar 2025 03:19:22 +0300 Subject: Fix infinite loop bug When *infinite* loop is called, there's an UB when accessing *p that points to n that was valid only inside the if block --- executor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'executor.c') diff --git a/executor.c b/executor.c index 0542a9c..5806981 100644 --- a/executor.c +++ b/executor.c @@ -251,10 +251,9 @@ enum cccl_ExecutorStatus cccl_execute(struct cccl_Node *code, struct cccl_Variab } break; case cccl_Node_INFINITE: { - short *p; + short n = 1, *p; if (code->value == '_') { - short n = 1; p = &n; } else { -- cgit 1.4.1