www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ondrej Pribyl <o.pri...@ucl.ac.uk>
Subject general/736: pointers cast as ints of different size - potential memory problems
Date Fri, 13 Jun 1997 15:50:01 GMT

>Number:         736
>Category:       general
>Synopsis:       pointers cast as ints of different size - potential memory problems
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache (Apache HTTP Project)
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Jun 13 08:50:01 1997
>Originator:     o.pribyl@ucl.ac.uk
>Release:        1.2.0
compiler: gcc
system:   OSF1 V3.2 41 alpha
During compilation by gcc (not DEC's cxx) you get complaints about
pointers being cast as integers of a different size in alloc.c,
http_config.c, mod_alias.c, mod_dir.c, alloc.h, http_core.c,
mod_browser.c, mod_rewrite.c.  This is no wonder as any reasonable
compiler on any 64-bit machine should complain if you cast a pointer
to a 32-bit int.  I suspect memory problems might occur due to this
handling of pointers.
Compile Apache 1.2.0 (the older versions had the same problem, I
think) with a good compiler on a 64-bit machine.
The fix is quite simple, just change the relevant
occurences of `int' into `long.'  You can pick up my ideas of how
to change things at http://www.phys.ucl.ac.uk/~op/changes.tar.gz
(or http://ross.phys.ucl.ac.uk/~op/changes.tar.gz, or
http://guarnerius.phys.ucl.ac.uk/~op/changes.tar.gz).  Unfortunately,
I am not absolutely sure I have done everything consistently, after
all I have not written Apache.  But the server seems to be running
rather happily.  On 32-bit machines, longs are often the same length
as ints (32 bits), so changing the important `ints' into `longs'
should be OK.  Alternatively, you can introduce preprocessor
directives of the sort:

#if defined( __alpha) || defined(__mips64)
long stuff
int stuff

etc, and put the `long' alternatives inside those.

View raw message