libm: one more static analysis fix.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 10 Aug 2018 15:22:02 -0400
changeset 12108eb2820ee52ee
parent 12107 7c7cee9f2bc4
child 12109 00411ca61edb
libm: one more static analysis fix.
src/libm/k_rem_pio2.c
     1.1 --- a/src/libm/k_rem_pio2.c	Fri Aug 10 15:04:08 2018 -0400
     1.2 +++ b/src/libm/k_rem_pio2.c	Fri Aug 10 15:22:02 2018 -0400
     1.3 @@ -190,7 +190,9 @@
     1.4  	    iq[i] =  (int32_t)(z-two24*fw);
     1.5  	    z     =  q[j-1]+fw;
     1.6  	}
     1.7 -	iq[jz] = 0;
     1.8 +	if (jz < SDL_arraysize(iq)) {
     1.9 +        SDL_memset(&iq[jz], 0, sizeof (q) - (jz * sizeof (iq[0])));
    1.10 +    }
    1.11  
    1.12      /* compute n */
    1.13  	z  = scalbn(z,q0);		/* actual value of z */
    1.14 @@ -273,6 +275,9 @@
    1.15  	    for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k];
    1.16  	    fq[jz-i] = fw;
    1.17  	}
    1.18 +	if ((jz+1) < SDL_arraysize(f)) {
    1.19 +        SDL_memset(&fq[jz+1], 0, sizeof (fq) - ((jz+1) * sizeof (fq[0])));
    1.20 +    }
    1.21  
    1.22      /* compress fq[] into y[] */
    1.23  	switch(prec) {