diff options
| author | Nakidai <nakidai@disroot.org> | 2025-03-31 03:19:22 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2025-03-31 03:19:22 +0300 |
| commit | 00dbb67ff654c4d76ef1c3177927bc8eebff6f85 (patch) | |
| tree | ed43ec7967e72ea99b823904da1283cbb8fe4501 | |
| parent | 2efe02624ba94618da722acd4e6ad49d9610afd8 (diff) | |
| download | 3cl-00dbb67ff654c4d76ef1c3177927bc8eebff6f85.tar.gz 3cl-00dbb67ff654c4d76ef1c3177927bc8eebff6f85.zip | |
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
| -rw-r--r-- | executor.c | 3 |
1 files changed, 1 insertions, 2 deletions
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 { |