[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sheflug] Re: [Sheflug - Sheffield Linux User's Group] Re: Segfaults & ld.sowierditude



>>>>> "Bob" == Bob Ham <u9rah [at] dcs.shef.ac.uk> writes:

    Bob> Like I say, it's not my instruction that's segfaulting.

A bogus pointer can point _anywhere_.  The code manipulating the bogus
pointer doesn't care; the code that gets mashed, does.  Your (bogus)
code doesn't crash, it's the code that lives in memory that gets
smashed by the bogus code crashes.  Or code that uses data that gets
smashed.  Many versions of malloc keep malloc housekeeping data mixed
with the heap:

+--------------+
| malloc parms |
+--------------+
|              | <-- aPtr
|  heap data   |
|              |
+--------------+

Guess what happens to malloc if you do aPtr++ = rand(); ?

(I don't know if this is true of dlmalloc.)

    >> Have you tried Electric Fence and cousins?

    Bob> Never heard of it; care to expand on that?

Standard package in all the distributions AFAIK (Debian and
TurboLinux, anyway).  Replaces malloc and automatically watches all
pointers amlloced for evil behavior.


-- 
University of Tsukuba                Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Institute of Policy and Planning Sciences       Tel/fax: +81 (298) 53-5091
_________________  _________________  _________________  _________________
What are those straight lines for?  "XEmacs rules."
---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word 
 "unsubscribe" in the body of the message. 

  GNU the choice of a complete generation.