From: Elia Pinto Date: Mon, 04 Nov 2019 09:59:23 GMT Subject: [PATCH 32/32] date.c: fix code that may overflow 'int' before it is converted to 'time_t' Message-ID: <20191104095923.116086-3-gitter.spiros@gmail.com> In-Reply-To: <20191104095923.116086-1-gitter.spiros@gmail.com> Fix the LGTM warning fired by the rule that finds code that could convert the result of an integer multiplication to a larger type. Since the conversion applies after the multiplication, arithmetic overflow may still occur. Signed-off-by: Elia Pinto --- date.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/date.c b/date.c index 041db7db4e..b8dcbdbb0e 100644 --- a/date.c +++ b/date.c @@ -1172,7 +1172,7 @@ static const char *approxidate_alpha(const char *date, struct tm *tm, struct tm while (tl->type) { int len = strlen(tl->type); if (match_string(date, tl->type) >= len-1) { - update_tm(tm, now, tl->length * *num); + update_tm(tm, now, (time_t)tl->length * *num); *num = 0; *touched = 1; return end; -- 2.24.0.rc0.467.g566ccdd3e4.dirty