Add n_points guards in the LoadEnvelope2 loop.

Clang static analysis reports these as 'Result of operation is
garbage or undefined' errors.
This commit is contained in:
Reece H. Dunn
2017-09-13 07:28:58 +01:00
parent 4a882e21d3
commit 57108e1ed7
+3 -3
View File
@@ -1408,10 +1408,10 @@ static int LoadEnvelope2(FILE *f, const char *fname)
ix = -1;
ix2 = 0;
for (x = 0; x < ENV_LEN; x++) {
if (x > env_x[ix+4])
if (n_points > 0) for (x = 0; x < ENV_LEN; x++) {
if (n_points > 3 && x > env_x[ix+4])
ix++;
if (x >= env_x[ix2+1])
if (n_points > 2 && x >= env_x[ix2+1])
ix2++;
if (env_lin[ix2] > 0) {