preproc: Fixed bug that would cause preproc current depth to be
authorLukas Krickl <lukas@krickl.dev>
Mon, 23 Mar 2026 04:56:35 +0000 (05:56 +0100)
committerLukas Krickl <lukas@krickl.dev>
Mon, 23 Mar 2026 04:56:35 +0000 (05:56 +0100)
uninitialized.

This would randomly cause preproc to fail.

src/ulas.c

index bbb51df3bdf78940391710d957b546082196f1c6..93fdf70f73c871a6e2d2156278e0736ef12db3ef 100644 (file)
@@ -979,7 +979,7 @@ void ulas_trimend(char c, char *buf, unsigned long n) {
 char *ulas_preprocexpand2(struct ulas_preproc *pp, const char *raw_line,
                          unsigned long *n, int recursive); 
 void ulas_preprocexpand_rec(struct ulas_preproc *pp) {
-       unsigned long n;
+       unsigned long n = 0;
   /* expand macro result again to allow
    * defines to appear in the macro
         */
@@ -1539,6 +1539,7 @@ int ulas_preprocnext(struct ulas_preproc *pp, FILE *dst, FILE *src, char *buf,
 struct ulas_preproc ulas_preprocinit(void) {
        int i;
   struct ulas_preproc pp;
+       memset(&pp, 0, sizeof(pp));
        pp.defs = NULL;
        pp.defslen = 0;
        pp.tok = ulas_str(1);