goose wrote:
>
I've summarised the replies here so that I could
reply to all without scattering the replies through
the thread.
---------------------------------------------------------------
Malcom wrote:
>There's a much easier way of achieveing what you want to do.
Simply put a structure at the start of the allocated memory, add
your control information, and return the pointer immediately
after. Then when the user calls the free, subtract the size of the
controlstructu re, and free. Similarly for the access functions.
.... large snip ...
Why don't you take a look at the methods I use in malldbg to detect
invalid structure in nmalloc. This is all contained in my
nmalloc.zip package, available for DJGPP at:
<http://cbfalconer.home .att.net/download/>
Basically validation is a dynamic thing, walking the known heap
structure and looking for disagreements between lengths and
next/prev pointers. There is also provision for maintaining
markers, of the 0xdeadbeef variety.
Conceded, this is not the same thing as validating a pointer
candidate in user space, but it does yield a comprehensive list of
valid pointers. Also, the methods used are not portable, but are
suited to systems with similar memory organization to DJGPP, which
is most OSs today.
--
Chuck F (cb********@yah oo.com) (cb********@mai neline.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.netUSE maineline address!