From 7d24772beec61baf1566889fb70b0556b66e5ad5 Mon Sep 17 00:00:00 2001 From: Andreas Kreuzmann Date: Wed, 19 Aug 2020 16:12:27 +0200 Subject: [PATCH] Fixed overflow bug by casting to int32_t --- sfm-common/sfm_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfm-common/sfm_common.c b/sfm-common/sfm_common.c index 997fdcb..ab923a3 100644 --- a/sfm-common/sfm_common.c +++ b/sfm-common/sfm_common.c @@ -107,7 +107,7 @@ int16_t sfm_common_convert_flow_float(const SfmConfig* sfm_config, } *flow = - (flow_raw - sfm_config->flow_offset) / (float)(sfm_config->flow_scale); + ((int32_t)flow_raw - (int32_t)sfm_config->flow_offset) / (float)(sfm_config->flow_scale); return 0; }