Skip to content

Commit

Permalink
Fix crash, when out of memory.
Browse files Browse the repository at this point in the history
Submitted by: Reasoning report ID 29
Reviewed by: Erik Abele, Ian Holsman


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@104887 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Andre Malo committed Aug 28, 2004
1 parent 566b14c commit e6b479e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
21 changes: 1 addition & 20 deletions STATUS
@@ -1,5 +1,5 @@
APACHE 2.0 STATUS: -*-text-*-
Last modified at [$Date: 2004/08/28 16:11:42 $]
Last modified at [$Date: 2004/08/28 16:20:08 $]

Release:

Expand Down Expand Up @@ -262,25 +262,6 @@ PATCHES TO BACKPORT FROM 2.1
shows breakage on Solaris which can't -lcrypto -lssl without
the extra pkgconfig/openssl.pc Libs: * foo }

* ab: catch out of memory (reasoning report ID 29)
support/ab.c: r1.125
+1: nd, erikabele, ianh
0: trawick, who is not about to stand in anybody's way on this,
but has two comments nonetheless:
a) with no abort function specified for the pools, this is just
one of many possible failures
b) my guess is that a heap shortage encountered by ab is
much more likely to be caused by an ab bug instead of by a
user setup error (ulimit) or system resource shortage...
is an error message better than a coredump in that case?

nd: hmm. This one is a pure (and obvious) malloc. Once we may
decide to use a pool-abort_fn; then the situation turns
around... :)
Yes, I think, a useful error message is better than
a coredump in this case.
jerenkrantz: Oh, bah. Let 'em segfault. Use flood!

* mod_ssl: fix a link failure when the openssl-engine libraries are
present but the engine headers are missing.
modules/ssl/mod_ssl.c: r1.87
Expand Down
10 changes: 7 additions & 3 deletions support/ab.c
Expand Up @@ -1599,7 +1599,11 @@ static void test(void)
* Combine headers and (optional) post file into one contineous buffer
*/
if (posting == 1) {
char *buff = (char *) malloc(postlen + reqlen + 1);
char *buff = malloc(postlen + reqlen + 1);
if (!buff) {
fprintf(stderr, "error creating request buffer: out of memory\n");
return;
}
strcpy(buff, request);
strcpy(buff + reqlen, postdata);
request = buff;
Expand Down Expand Up @@ -1768,14 +1772,14 @@ static void test(void)
static void copyright(void)
{
if (!use_html) {
printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.121.2.11 $> apache-2.0");
printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.121.2.12 $> apache-2.0");
printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n");
printf("\n");
}
else {
printf("<p>\n");
printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.121.2.11 $");
printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AP_AB_BASEREVISION, "$Revision: 1.121.2.12 $");
printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/<br>\n");
printf("</p>\n<p>\n");
Expand Down

0 comments on commit e6b479e

Please sign in to comment.