Ticket #2 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

64-bit eggdrop builds crash on some systems

Reported by: pseudo Owned by: pseudo
Priority: blocker Milestone: 1.6.20
Component: Core Version: 1.6.20
Keywords: Cc:

Description

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
dereferenced.

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
variable:

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
purpose.

Attachments

eggdrop1.6-64bit.patch Download (59.2 KB) - added by pseudo 4 years ago.

Change History

comment:1 Changed 4 years ago by simple

  • Milestone changed from 1.6.21 to 1.6.20

comment:2 Changed 4 years ago by simple

  • Version set to 1.6.20 CVS

comment:3 Changed 4 years ago by pseudo

  • Owner set to pseudo
  • Status changed from new to accepted

comment:4 Changed 4 years ago by pseudo

  • Priority changed from critical to blocker

Changed 4 years ago by pseudo

comment:5 Changed 4 years ago by pseudo

  • Status changed from accepted to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.