summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-03-17 11:38:25 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-03-17 15:11:31 -0700
commit2d26300402cf09e2ff68e3ff42a5c0bb832c39dd (patch)
tree3640e6b43b0473e3cbbdcb58200529dff09f0f3f
parent47f92b92acc9eb4875590cf197d60e053cd36781 (diff)
downloadsubsurface-2d26300402cf09e2ff68e3ff42a5c0bb832c39dd.tar.gz
Core: cast before multiplication to avoid potential overflow
Found via LGTM.com Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/deco.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/deco.c b/core/deco.c
index 78ab23f0a..c3a8059c0 100644
--- a/core/deco.c
+++ b/core/deco.c
@@ -292,7 +292,7 @@ double tissue_tolerance_calc(struct deco_state *ds, const struct dive *dive, dou
if (plot_depth) {
++sum1;
sumx += plot_depth;
- sumxx += plot_depth * plot_depth;
+ sumxx += (long)plot_depth * plot_depth;
double n2_gradient, he_gradient, total_gradient;
n2_gradient = update_gradient(ds, depth_to_bar(plot_depth, &displayed_dive), ds->bottom_n2_gradient[ds->ci_pointing_to_guiding_tissue]);
he_gradient = update_gradient(ds, depth_to_bar(plot_depth, &displayed_dive), ds->bottom_he_gradient[ds->ci_pointing_to_guiding_tissue]);