From eed88fc61f009c3e397c4dbc6248356978a6031d Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Wed, 15 Apr 2026 16:14:37 +0100 Subject: [PATCH] ivlpp: Ensure def_buf is allocated when calling macro_start_args() macro_start_args() inserts a null string for arg 0 at the start of def_buf. This allows macro_finish_arg() to calculate the length of the first actual argument (arg 1). But macro_start_args() relied on def_buf having already been allocated, which isn't the case when all the macros are pre-defined. This fixes issue #1323. --- ivlpp/lexor.lex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index 9094368ac..b20d27119 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -1599,10 +1599,10 @@ static void macro_start_args(void) * entry for arg 0. This will be used by macro_finish_arg() to * calculate the buffer location for arg 1. */ - if (def_buf) { - def_buf_free = def_buf_size - 1; - def_buf[0] = 0; - } + def_buf_grow_to_fit(1); + def_buf_free = def_buf_size - 1; + def_buf[0] = 0; + def_argo[0] = 0; def_argl[0] = 0; def_argc = 1;