From: Jan Kaluža Date: Thu, 14 Aug 2014 12:15:31 +0000 (+0000) Subject: * support/ab.c: Fix crash caused by integer overflow when printing stats with X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=823f671813c3bd83af6b7b58026b78465679428d;p=thirdparty%2Fapache%2Fhttpd.git * 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 --- diff --git a/support/ab.c b/support/ab.c index f9888e15922..7f0777b23a1 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);