From 57108e1ed7fa93c7a7f1515339a8d72ff7322885 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Wed, 13 Sep 2017 07:28:58 +0100 Subject: [PATCH] Add n_points guards in the LoadEnvelope2 loop. Clang static analysis reports these as 'Result of operation is garbage or undefined' errors. --- src/libespeak-ng/compiledata.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libespeak-ng/compiledata.c b/src/libespeak-ng/compiledata.c index f32754cf..213692b7 100644 --- a/src/libespeak-ng/compiledata.c +++ b/src/libespeak-ng/compiledata.c @@ -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) {