Description: Fix use of uninitialized variables.
Origin: https://src.fedoraproject.org/rpms/qepcad-B/blob/60ceecd/f/qepcad-B-uninit.patch
Forwarded: https://github.com/chriswestbrown/qepcad/pull/2
Last-Update: 2021-06-23

--- a/cad2d/src/CAD2D.c
+++ b/cad2d/src/CAD2D.c
@@ -23,6 +23,8 @@
        Word A,D,F,F_e,F_n,F_s,Fh,J,P,Q,Ths,f,i,r,t;
        Word L;
 Step1: /* Normalize. */
+       t = -1;
+       F_e = F_n = F_s = NIL;
        FIRST4(Fs,&r,&f,&Q,&Fh);
        F = NORMQFF(Fh);
        GVNQFF = F;
--- a/cad2d/src/TICAD.c
+++ b/cad2d/src/TICAD.c
@@ -30,6 +30,7 @@
 Step1: /* Initialize. */
        D = INITPCAD();
        L = 0;
+       d = 0;
 
 Step2: /* Choose. */
        GVPC = D;
@@ -51,6 +52,7 @@
 	   else
 	     L = RED2(L); }
 	 else if (d == 1 && L == NIL) { /* Init for 1D sections */
+	   c = NIL;
 	   d = 0;
 	   L = RED(LELTI(D,CHILD));
 	 }
--- a/extensions/adj2d/oldadj/ACMADJ2D.c
+++ b/extensions/adj2d/oldadj/ACMADJ2D.c
@@ -29,6 +29,7 @@
   FIRST2(Ip,&ip1,&ip2);
   i1 = RNLBRN(ip1);
   i2 = RNLBRN(ip2);
+  t = 0;
 
 Step2: /* Get sample points for c_l and c_r. */
   i_l = RNLBRN(SPRLC(c_l));
--- a/extensions/lift2D/modHIPRRID.c
+++ b/extensions/lift2D/modHIPRRID.c
@@ -28,6 +28,7 @@
 	k = HIPPRB(n,A);
 
 Step2: /* Isolate the positive roots. */
+	L = NIL;
 	if (k == NIL) {
 	   L1 = NIL;
 	   goto Step3; }
--- a/extensions/lift2D/modIBPRRIOAPSF.c
+++ b/extensions/lift2D/modIBPRRIOAPSF.c
@@ -77,6 +77,7 @@
 Step5: /* Refine roots? */
 	if (k == NIL)
 	  goto Return;
+	Js = NIL;
 	Ls = NIL;
 	for(Lp = L; Lp != NIL; Lp = RED(Lp))
         { 
--- a/extensions/rend/WRITE_PS_INTERACTIVE.cc
+++ b/extensions/rend/WRITE_PS_INTERACTIVE.cc
@@ -262,6 +262,8 @@
       if (t == 'p') {
 	  SWRITE("Enter projetion factor by (level,index): ");
 	  p = LREAD(); }
+      else
+	  p = NIL;
 
       switch(c) {
       case 'x': // 1D Sectors
--- a/extensions/sfext/addpol/MINPFSETNSC.c
+++ b/extensions/sfext/addpol/MINPFSETNSC.c
@@ -42,7 +42,7 @@
       Word x_s,js,Ls,O,Q,Q_i,Sp,Pp,i,Cp,*V,*Vp,**A,a,N,k,S_r,I,j,p;
 
 Step1: /* Initialization. */
-      C = NIL; Sltr = NIL; Pltr = NIL; N = LENGTH(K);
+      C = NIL; Sltr = NIL; S_r = NIL; Pltr = NIL; N = LENGTH(K);
 
 Step2: /* Loop over each level in D. */
       for(r = 1; r <= N; r++) {
--- a/extensions/sfext/espcad/PCAD2ESPCAD.c
+++ b/extensions/sfext/espcad/PCAD2ESPCAD.c
@@ -44,6 +44,8 @@
            P_i = RED(P_i);
            s = RED(s); }
          s = INV(ss); }
+       else
+	 s = NIL;
 
 Step3: /* Construct extended Sub-CAD cell structure. */
        EDs = LIST8(C,A,LELTI(Ds,SC_INX),NIL,s,NIL,UNDET,UNDET);
--- a/extensions/sfext/extlang/SCAD2ESCAD.c
+++ b/extensions/sfext/extlang/SCAD2ESCAD.c
@@ -27,6 +27,8 @@
 	   P_i = RED(P_i);
 	   s = RED(s); }
 	 s = INV(ss); }
+       else
+	 s = NIL;
 
 Step3: /* Construct extended Sub-CAD cell structure. */
        EDs = LIST7(C,A,LELTI(Ds,SC_INX),NIL,s,NIL,UNDET);
--- a/extensions/sfext/formula/FMAATOMREAD.c
+++ b/extensions/sfext/formula/FMAATOMREAD.c
@@ -18,7 +18,7 @@
        /* hide r,s,t; */
 
 Step1: /* Read the left polynomial. */
-        t = 1; r = LENGTH(V);
+        t = 1; r = LENGTH(V); F = NIL;
         IPEXPREAD(r,V,&P1,&t); if (t == 0) goto Return;
 
 Step2: /* Read the relational operator. */
@@ -71,6 +71,7 @@
     p = SECOND(p);
 
   /* Is p already in P? */
+  pp = NIL;
   P_r = LELTI(P,r); *t = 0;
   for(Pp = P_r; Pp != NIL; Pp = RED(Pp)) {
     pp = FIRST(Pp);
--- a/extensions/sfext/formula/FMASMOOTH.c
+++ b/extensions/sfext/formula/FMASMOOTH.c
@@ -16,6 +16,7 @@
   if (ISLIST(F1) || F1 == TRUE || F1 == FALSE) {
     G = F;
     goto Return; }
+  G = NIL;
 
 Step2: /* AND's */
   if (F1 == ANDOP) {
--- a/extensions/sfext/sfcons/SFC3.c
+++ b/extensions/sfext/sfcons/SFC3.c
@@ -90,7 +90,7 @@
 	switch(m) {
 	case (0) : SF = NECCONDS(Lt,Lf,LA,Pp); break;
 	case (1) : SF = NAIVESF(Lt,Lf,LA,Pp); break; 
-	case (2) : SWRITE("GEOTEST requires the extended language!\n"); goto Return; } }
+	case (2) : SF = NIL; SWRITE("GEOTEST requires the extended language!\n"); goto Return; } }
 
 Step4: /* Massage the formula. */
       pflag = 1;
--- a/extensions/sfext/sfcons/SFC3f.c
+++ b/extensions/sfext/sfcons/SFC3f.c
@@ -88,7 +88,7 @@
 	switch(m) {
 	case (0) : SF = NECCONDS(Lt,Lf,LA,Pp); break;
 	case (1) : SF = NAIVESF(Lt,Lf,LA,Pp); break; 
-	case (2) : SWRITE("GEOTEST requires the extended language!\n"); goto Return; } }
+	case (2) : SF = NIL; SWRITE("GEOTEST requires the extended language!\n"); goto Return; } }
 
 Step4: /* Massage the formula. */
       pflag = 1;
--- a/extensions/sfext/sfcons/SFC4.c
+++ b/extensions/sfext/sfcons/SFC4.c
@@ -31,6 +31,7 @@
 {
       Word t,SF,Dp,Pp,Lt,Lf,LA,Q,D1,P1,D0,P0,J0,i,Lp,pflag;
       char e,s,m,c;
+      e = s = m = c = '\0';
       T1 = T2 = T3 = T4 = 0;
       F1 = 0;
 
--- a/extensions/sfext/sfcons/SFCFULLDf.c
+++ b/extensions/sfext/sfcons/SFCFULLDf.c
@@ -52,6 +52,7 @@
 
       if (Lt == NIL && Lf == NIL) {
 	SWRITE("No cells have truth values!\n");
+	SF = NIL;
 	goto Return; }
       t = ESPCADDOPFSUFF(Pp,LIST1(Dp));
       LA = LISTOETAmod(Pp,n,t==NIL);
--- a/source/io/ATOMFRDR.c
+++ b/source/io/ATOMFRDR.c
@@ -76,7 +76,7 @@
         Word t, F, r, j, P2, P2p, r1, r2, a, P, s;
 
 Step1: /* Prepare */
-        t = 1; r = LENGTH(V);
+        t = 1; r = LENGTH(V); F = NIL;
 
 
 Step2: /* Read "_root_" */
--- a/source/io/CATTRNRDR.c
+++ b/source/io/CATTRNRDR.c
@@ -39,7 +39,7 @@
        goto Return;
 
 Step3: /* Error exit. */
-       DIELOC(); t = 0;
+       DIELOC(); V = 0; t = 0;
 
 Return: /* Prepare for return. */
        *V_ = V;
--- a/source/io/DESIREDRDR.c
+++ b/source/io/DESIREDRDR.c
@@ -15,6 +15,7 @@
        /* hide C,C1,R,V1,V2,t; */
 
 Step1: /* Atomic condition. */
+       F = NIL;
        t = 1;
        C = CREADB(); if (C == '[') goto Step2;
        BKSP(); 
--- a/source/io/FREADR.c
+++ b/source/io/FREADR.c
@@ -23,7 +23,7 @@
        /* hide C,i,q,r,t; */
 
 Step1: /* Read quantifier list. */
-       t = 1; Q = NIL; r = LENGTH(V);
+       Fs = NIL; t = 1; Q = NIL; r = LENGTH(V);
        for (i = f + 1; i <= r; i++)
          {
          C = CREADB();
--- a/source/io/GREADR.c
+++ b/source/io/GREADR.c
@@ -33,7 +33,7 @@
        BKSP(); a = S * a; goto Return;
 
 Step3: /* Error. */
-       DIELOC(); t = 0; goto Return;
+       DIELOC(); a = 0; t = 0; goto Return;
 
 Return: /* Prepare for return. */
        *a_ = a;
--- a/source/io/LGOPRDR.c
+++ b/source/io/LGOPRDR.c
@@ -50,7 +50,7 @@
          { SWRITE("Error LGOPRDR: Logic operator was expected.\n"); goto Step2; }
 
 Step2: /* Error exit. */
-       DIELOC(); t = 0; goto Return;
+       DIELOC(); p = 0; t = 0; goto Return;
 
 Return: /* Prepare for return. */
        *p_ = p;
--- a/source/io/QFRDR.c
+++ b/source/io/QFRDR.c
@@ -39,7 +39,7 @@
        goto Return;
 
 Step2: /* Error exit. */
-       DIELOC(); t = 0; goto Return;
+       DIELOC(); q = 0; t = 0; goto Return;
 
 Return: /* Prepare for return. */
        *q_ = q;
--- a/source/io/RLOPRDR.c
+++ b/source/io/RLOPRDR.c
@@ -31,7 +31,7 @@
        goto Return;
 
 Step2: /* Error exit. */
-       DIELOC(); t = 0; goto Return;
+       DIELOC(); p = 0; t = 0; goto Return;
 
 Return: /* Prepare for return. */
        *p_ = p;
--- a/source/main/QEPCADauto.c
+++ b/source/main/QEPCADauto.c
@@ -27,6 +27,8 @@
        char c1,c2; /* Chris variables. */
 
 Step1: /* Normalize. */
+       t = -1;
+       F_e = F_n = F_s = NIL;
        FIRST4(Fs,&r,&f,&Q,&Fh);
        F = NORMQFF(Fh);
        if (GVUA != NIL) GVNA = NORMQFF(GVUA);
--- a/source/main/QEPCAD.c
+++ b/source/main/QEPCAD.c
@@ -26,6 +26,8 @@
        Word Cs,Ps,Qs,Pps,Cps,Qps,SF; /* Chris variables. */
        char c1,c2; /* Chris variables. */
 Step1: /* Normalize. */
+       t = -1;
+       F_e = F_n = F_s = NIL;
        FIRST4(Fs,&r,&f,&Q,&Fh);
                /*Int*/ PCNSTEP = 1;
                /*Int*/ if (INTERACT()) USERINT(LFS("Before Normalization"),'a');
--- a/source/ticad/AFUPMPR.c
+++ b/source/ticad/AFUPMPR.c
@@ -27,6 +27,7 @@
        /* hide L1,Lp,j,jp,s,t,v,vp; */
 
 Step1: /* Initialize. */
+       j = 0;
        FIRST2(J,&a,&b);
        t = AFUPSR(M,I,B,b);
        if (t == 0)
--- a/source/ticad/SUBST.c
+++ b/source/ticad/SUBST.c
@@ -24,6 +24,7 @@
        Word P,L,Sp,T1,T2,G,Q,f,i;
 
 Step1: /* Substitute. */
+        f = UNDET;
         L = NIL;
         S = NIL;
         Bp = B;
--- a/source/ticad/SUBSTR.c
+++ b/source/ticad/SUBSTR.c
@@ -24,6 +24,7 @@
        Word P,L,Q,T1,T2,Sp,G,f,i;
 
 Step1: /* Do it. */
+       f = UNDET;
        L = NIL;
        S = NIL;
        Bp = B;
--- a/source/userint/PREQNCONSTL.c
+++ b/source/userint/PREQNCONSTL.c
@@ -73,7 +73,7 @@
 
 Word POLYLABEL(Word P, Word p, Word r, Word *t)
 {
-  Word P_r, Pp, pp;
+  Word P_r, Pp, pp = NIL;
 
   for(; PDEG(p) == 0; r--)
     p = SECOND(p);
