Ticket #2 (closed defect: fixed)
64-bit eggdrop builds crash on some systems
|Reported by:||pseudo||Owned by:||pseudo|
Eggdrop crashes on *BSD/amd64 and likely on 64-bit big-endian architectures.
Crashes usually happen in modules allocating memory trough mod_malloc() but are
potentially possible in various other places.
The root of the problem is the assumption that pointers are of the same size as
ints, which is correct for a 32 bit data type model, but obviously not for
64-bit build environments. Pointers and ints are used interchangeably
everywhere in the source code, which leads to crashes when a garbled pointer is
The crash on BSD systems is unconditional due to the fact that malloc()
allocates high addresses by default (which don't fit into an int). Users of
FreeBSD can avoid a crash on startup by setting the MALLOC_OPTIONS environment
env MALLOC_OPTIONS='Dm' ./eggdrop
This will make malloc() to map lower addresses so that truncating a pointer to
int might not lose meaningful information and eggdrop will be able to run.
The bug needs to be fixed by removing any casts of pointer to int and changing
function arguments and variables to use proper data types suitable for their