From e0ca33132dea493dae43f9ccdcd21dda5a1f3161 Mon Sep 17 00:00:00 2001 From: luochunbei Date: Sun, 10 Oct 2021 14:39:51 +0800 Subject: add explicit data type conversion to avoid integer overflow --- src/time_ops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/time_ops.h b/src/time_ops.h index 9b883a4..3614cf2 100644 --- a/src/time_ops.h +++ b/src/time_ops.h @@ -61,7 +61,7 @@ do \ { \ int64_t tmp_time; \ - tmp_time = (c) * (int64_t) ((tvp)->tv_sec * SEC_TO_##prefix##SEC + \ + tmp_time = (c) * (int64_t) ((int64_t) (tvp)->tv_sec * SEC_TO_##prefix##SEC + \ (int64_t) (tvp)->tv_##prefix##sec); \ (result)->tv_##prefix##sec = tmp_time % SEC_TO_##prefix##SEC; \ (result)->tv_sec = (tmp_time - (result)->tv_##prefix##sec) / \ -- cgit v1.2.1