httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject Re: [PATCH] fix to assert bugosity
Date Sun, 29 Jun 1997 04:46:26 GMT
I would prefer an ap_assert instead on the basis that it is best to avoid
messing with system defines if you don't have to, but that's just me...

Hmm.  Why do we have to include assert.h to begin with?

Oh, something else I noticed about this change... unless I am missing
something, it is BOGUS.  Bad.  Bad.  It appears like some of the code (eg.
http_bprintf.c) relies on an assert to abort the program flow in certain
cases.  The new one does not terminate.  That opens possible security
holes.  I do not think that assert() should be replaced by anything which
doens't terminate the request, and perhaps even the process.  It is
dangerous to change the semantics of such a call.

On Sat, 28 Jun 1997, Rodent of Unusual Size wrote:

>     Submitted for HEAD inclusion, APACHE_1_2_X too if the original patch
>     was applied there.
> 
>     Somewhere in the recent spate of commits (Ben's, to-day in
>     <199706282239.PAA15042@hyperreal.com>), a change caused this to
>     start happening to a previously clean build (against HEAD).
> 
> cc -c   -O0 -g2 -DOSF1 -DSTATUS -DMAXIMUM_DNS  alloc.c
> /usr/lib/cmplrs/cc/cfe: Warning: /usr/include/assert.h:97: Macro assert redefined.
> cc -c   -O0 -g2 -DOSF1 -DSTATUS -DMAXIMUM_DNS  http_main.c
> /usr/lib/cmplrs/cc/cfe: Warning: /usr/include/assert.h:97: Macro assert redefined.
>     :
> cc -c   -O0 -g2 -DOSF1 -DSTATUS -DMAXIMUM_DNS  util_script.c
> /usr/lib/cmplrs/cc/cfe: Warning: /usr/include/assert.h:97: Macro assert redefined.
> 
>     The initial definition appears to be Apache's in httpd.h; the three
>     files above are #include-ing assert.h, which is redefining the macro
>     in the OS' image.
> 
>     The following patch appears to address this for Digital UNIX (OSF/1)
>     V3.2 by moving the #include of assert.h to above that for httpd.h,
>     and having httpd.h conditionally undefine the macro before
>     re-defining it.
> 
>     Any nasty side-effects on this for other platforms?
> 
>     #ken    :-)}
> 
> Index: httpd.h
> ===================================================================
> RCS file: /export/home/cvs/apache/src/httpd.h,v
> retrieving revision 1.118
> diff -c -r1.118 httpd.h
> *** httpd.h	1997/06/28 23:57:57	1.118
> --- httpd.h	1997/06/29 01:44:06
> ***************
> *** 767,770 ****
> --- 767,773 ----
>    * Redefine assert() to something more useful for an Apache...
>    */
>   void log_assert(const char *szExp,const char *szFile,int nLine);
> + #ifdef assert
> + #undef assert
> + #endif
>   #define assert(exp) (void)( (exp) || (log_assert(#exp, __FILE__, __LINE__), 0) )
> Index: alloc.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/alloc.c,v
> retrieving revision 1.34
> diff -c -r1.34 alloc.c
> *** alloc.c	1997/06/28 20:24:27	1.34
> --- alloc.c	1997/06/29 01:44:29
> ***************
> *** 58,68 ****
>    * rst --- 4/95 --- 6/95
>    */
>   
>   #include "httpd.h"
>   #include "multithread.h"
>   
>   #include <stdarg.h>
> - #include <assert.h>
>   
>   /*****************************************************************
>    *
> --- 58,68 ----
>    * rst --- 4/95 --- 6/95
>    */
>   
> + #include <assert.h>
>   #include "httpd.h"
>   #include "multithread.h"
>   
>   #include <stdarg.h>
>   
>   /*****************************************************************
>    *
> Index: http_main.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_main.c,v
> retrieving revision 1.166
> diff -c -r1.166 http_main.c
> *** http_main.c	1997/06/29 00:03:17	1.166
> --- http_main.c	1997/06/29 01:44:53
> ***************
> *** 75,80 ****
> --- 75,81 ----
>   
>   #define CORE_PRIVATE
>   
> + #include <assert.h>
>   #include "httpd.h"
>   #include "http_main.h"
>   #include "http_log.h"
> ***************
> *** 85,91 ****
>   #include "http_core.h"          /* for get_remote_host */
>   #include "scoreboard.h"
>   #include "multithread.h"
> - #include <assert.h>
>   #include <sys/stat.h>
>   #ifdef HAVE_SHMGET
>   #include <sys/types.h>
> --- 86,91 ----
> Index: util_script.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/util_script.c,v
> retrieving revision 1.61
> diff -c -r1.61 util_script.c
> *** util_script.c	1997/06/22 03:40:25	1.61
> --- util_script.c	1997/06/29 01:45:12
> ***************
> *** 51,56 ****
> --- 51,57 ----
>    */
>   
>   #define CORE_PRIVATE
> + #include <assert.h>
>   #include "httpd.h"
>   #include "http_config.h"
>   #include "http_conf_globals.h"
> ***************
> *** 60,66 ****
>   #include "http_core.h"		/* For document_root.  Sigh... */
>   #include "http_request.h"       /* for sub_req_lookup_uri() */
>   #include "util_script.h"
> - #include <assert.h>
>   
>   /*
>    * Various utility functions which are common to a whole lot of
> --- 61,66 ----
> 


Mime
View raw message