Bug 47178 - ab segfaults when called with a large -n parameter
Summary: ab segfaults when called with a large -n parameter
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: support (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk
: 49215 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-10 14:59 UTC by Philipp Hagemeister
Modified: 2012-02-26 16:55 UTC (History)
2 users (show)



Attachments
Patch adding a check of the result of the allocation of stats (481 bytes, patch)
2009-05-10 14:59 UTC, Philipp Hagemeister
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hagemeister 2009-05-10 14:59:00 UTC
Created attachment 23637 [details]
Patch adding a check of the result of the allocation of stats

Calling ab (the Apache benchmark utility) with the argument -n 1234567890 http://example.org (or any -n other value smaller than MAXINT, but bigger than the virtual memory divided by 32) causes ab to segfault. This is a result of using a dynamically allocated data structure(line ~1260) whose allocation(line 1559) is not checked. The size of this data structure is linearly dependent of the -n value. This may be a design bug in itself since it prevents ab runs with a potentially infinite number of requests, e.g. to test how many requests can be served in 42 seconds. The attached patch makes ab exit properly when the memory allocation fails.
Comment 1 Stefan Fritsch 2009-10-18 12:03:03 UTC
fixed in trunk in r826497
Comment 2 Stefan Fritsch 2010-04-28 15:35:17 UTC
not yet fixed in 2.2.x
Comment 3 Stefan Fritsch 2010-04-28 15:37:26 UTC
*** Bug 49215 has been marked as a duplicate of this bug. ***
Comment 4 Stefan Fritsch 2012-02-26 16:55:27 UTC
fixed in 2.4.1