[ECOS] Re: dlmalloc-2.6.4.c MALLOC_COPY broken?

Dave Lawrence dlawrence@ad-holdings.co.uk
Thu Jan 3 09:11:00 GMT 2008


Øyvind Harboe wrote:
> Where does dlmalloc come from?
> 
> eCos seems to be lacking some upstream bugfixes...
> 
> 
> 
> memcpy does not support overlapping memory ranges, which causes problems with
> optimized versions of memcpy.

Correct, according to ANSI the behavior of memcpy is undefined if the 
source and destination overlap, and I have definitely used an optimized 
memcpy that fails in this situation.

> 
> I haven't analyzed it enough to tell whether eCos is bitten by this.

Try putting some asserts in memcpy to trap any occurances of this... you 
will find the realloc breaks the rules.  It should use memmove instead.

> 
> 
> See:
> 
> http://sourceware.org/ml/libc-hacker/2000-12/msg00096.html
> http://sourceware.org/ml/libc-hacker/2000-12/msg00115.html
> http://ecos.sourceware.org/ml/ecos-patches/2007-12/msg00031.html
> 
> 
> 


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list