From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Fwd: Alignment check in strlen
Date: Wed, 20 Feb 2013 19:22:53 +0100 [thread overview]
Message-ID: <20130220182253.GT6181@port70.net> (raw)
In-Reply-To: <CAMRJFfL3ZnFdiW9_JS2p3mpvSLp_28zwmZDu3GbmNo+jkfdqsA@mail.gmail.com>
* Jonas Wagner <jonas.wagner@epfl.ch> [2013-02-20 19:05:28 +0100]:
> attached is a patch that makes the alignment check in strlen more
> consistent with the one in memcpy, and hopefully faster.
>
there is already a patch set to make string.h functions
more consistent
that addresses more issues but needs clean up
see febr 4 and 5
http://www.openwall.com/lists/musl/2013/02/
so yes at some point these should be fixed..
> In src/string/memcpy.c, I find the following:
>
> #define ALIGN (sizeof(size_t)-1)
> if (((uintptr_t)d & ALIGN) != ((uintptr_t)s & ALIGN))
> goto misaligned;
>
> In src/string/strlen.c, a different check was used instead:
>
> #define ALIGN (sizeof(size_t))
> for (; (uintptr_t)s % ALIGN; s++) if (!*s) return s-a;
>
> I do not think there is any particular reason for this difference.
>
> Best,
> Jonas
prev parent reply other threads:[~2013-02-20 18:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAMRJFfKkghLFLpxg4C12XQmNiWZpZbZGVYWwup5dXmZ7Ty=W-g@mail.gmail.com>
2013-02-20 18:05 ` Jonas Wagner
2013-02-20 18:22 ` Szabolcs Nagy [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=20130220182253.GT6181@port70.net \
--to=nsz@port70.net \
--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).