From b19b5a54c3b1f3421705cf0867c82e2b2c2f7cf0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Kalu=C5=BEa?= Date: Thu, 14 Aug 2014 12:15:31 +0000 Subject: [PATCH] * support/ab.c: Fix crash caused by integer overflow when printing stats with lot of requests (for example -n 500000000). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1617913 13f79535-47bb-0310-9956-ffa450edef68 --- support/ab.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support/ab.c b/support/ab.c index f9888e1592..7f0777b23a 100644 --- a/support/ab.c +++ b/support/ab.c @@ -1029,7 +1029,7 @@ static void output_results(int sig) ap_round_ms(stats[done - 1].time)); else printf(" %d%% %5" APR_TIME_T_FMT "\n", percs[i], - ap_round_ms(stats[(int) (done * percs[i] / 100)].time)); + ap_round_ms(stats[(unsigned long)done * percs[i] / 100].time)); } } if (csvperc) { @@ -1046,7 +1046,7 @@ static void output_results(int sig) else if (i == 100) t = ap_double_ms(stats[done - 1].time); else - t = ap_double_ms(stats[(int) (0.5 + done * i / 100.0)].time); + t = ap_double_ms(stats[(unsigned long) (0.5 + (double)done * i / 100.0)].time); fprintf(out, "%d,%.3f\n", i, t); } fclose(out); -- 2.40.0