URI:
       cc1: Avoid out of bound access - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit c9da9623aab2018a04e1bbfd0b54f5a031aa9aca
   DIR parent e3ca3473ebbafdcbf01c0a59a9db06027be90b95
  HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
       Date:   Thu, 30 Apr 2026 21:13:41 +0200
       
       cc1: Avoid out of bound access
       
       The function emitstrings() goes over all the elements of the initializer
       to dump any string involved in the initializer, and it uses the nary value
       from the type of the initializer. But this is wrong because in unions we
       have as many files as declared in the type, but we van have only one
       item in the initializer, and this was causing an out of order access.
       
       Diffstat:
         M src/cmd/scc-cc/cc1/init.c           |       2 +-
       
       1 file changed, 1 insertion(+), 1 deletion(-)
       ---
   DIR diff --git a/src/cmd/scc-cc/cc1/init.c b/src/cmd/scc-cc/cc1/init.c
       @@ -471,7 +471,7 @@ emitstrings(Node *np)
                                emit(ODECL, sym);
                                emit(OINIT, constnode(sym));
                        } else if (f == SINITLST)  {
       -                        n = np->type->n.elem;
       +                        n =  (np->type->op == UNION) ? 1 : np->type->n.elem;
                                for (i = 0; i < n; ++i)
                                        emitstrings(sym->u.init[i]);
                        }