This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: dlmalloc-2.6.4.c MALLOC_COPY broken?
- From: Dave Lawrence <dlawrence at ad-holdings dot co dot uk>
- To: ecos-discuss at sources dot redhat dot com
- Date: Thu, 03 Jan 2008 09:10:47 +0000
- Subject: [ECOS] Re: dlmalloc-2.6.4.c MALLOC_COPY broken?
- References: <c09652430712310515qe60f9den48383d2d6a18a3a7@mail.gmail.com>
Ø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