mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: cluts memcpy() test
Date: Wed, 20 Jul 2011 09:27:06 -0400	[thread overview]
Message-ID: <20110720132706.GA132@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAHf7i5TRRq_pnHc7cf5hK3htiektvR1SnXK5CBRa+PDzjM5qrA@mail.gmail.com>

On Wed, Jul 20, 2011 at 12:30:35PM +0200, Luka M. wrote:
> On Wed, Jul 20, 2011 at 2:28 AM, Solar Designer <solar@openwall.com> wrote:
> 
> > Luka, Rich -
> >
> > It'd be nice for cluts to detect issues like this:
> >
> > http://www.nodefense.org/eglibc.txt
> >
> > Maybe it already does?
> >
> 
> Hey Alexander. Cluts doesn't test negative values for memcpy. Such a thing
> hasn't occured to me: The prototype for the function specifies a size_t
> argument, and size_t is supposed to be unsigned. This means, _afaik_, that a
> negative value should be implicitly cast to a positive "equivalent". So, I

The problem is (or rather was; I assume it's fixed now) broken asm in
glibc that treated the unsigned value as if it were signed...

Note that musl will not allow you to allocate memory so large that the
unsigned size would be negative if interpreted as a signed value,
since that would create dangerous situations where ptrdiff_t
overflows. It may still be possible to make a region that large
explicitly using mmap, however.

Rich


      reply	other threads:[~2011-07-20 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20  0:28 Solar Designer
2011-07-20 10:30 ` Luka M.
2011-07-20 13:27   ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110720132706.GA132@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).