>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: [EMAIL PROTECTED] >Organization: apache >Release: 1.2.0 >Environment: compiler: gcc 2.7.2.1 system: OSF1 V3.2 41 alpha >Description: 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. >How-To-Repeat: Compile Apache 1.2.0 (the older versions had the same problem, I think) with a good compiler on a 64-bit machine. >Fix: 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 #else int stuff #endif etc, and put the `long' alternatives inside those. >Audit-Trail: >Unformatted:
