From 912a194b07f96da291ac4de7d58c2313f7c73e3f Mon Sep 17 00:00:00 2001 From: Joe Orton <jorton@apache.org> Date: Fri, 9 Mar 2018 09:24:30 +0000 Subject: [PATCH] Merge r1617913 from trunk: * support/ab.c: Fix crash caused by integer overflow when printing stats with lot of requests (for example -n 500000000). Submitted by: jkaluza Reviewed by: jorton, jim, ylavic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1826310 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++-- support/ab.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 3ae7d27d8f..9c4c2de02c 100644 --- a/CHANGES +++ b/CHANGES @@ -14,8 +14,8 @@ Changes with Apache 2.4.32 *) mod_ssl: Support SSL DN raw variable extraction without conversion to UTF-8, using _RAW suffix on variable names. [Joe Orton] - *) ab: Fix send length calculation for the non-blocking connect case - introduced in 2.4.30. [Joe Orton] + *) ab: Fix https:// connection failures (regression in 2.4.30); fix + crash generating CSV output for large -n. [Joe Orton, Jan Kaluza] Changes with Apache 2.4.31 diff --git a/support/ab.c b/support/ab.c index f1020c653a..3d546afc77 100644 --- a/support/ab.c +++ b/support/ab.c @@ -1106,7 +1106,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) { @@ -1123,7 +1123,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