public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincent+libc at vinc17 dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/12518] memcpy acts randomly (and differently) with overlapping areas
Date: Wed, 04 May 2011 13:32:00 -0000	[thread overview]
Message-ID: <bug-12518-131-5NtzWO6GCg@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-12518-131@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=12518

Vincent Lefèvre <vincent+libc at vinc17 dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent+libc at vinc17 dot
                   |                            |org

--- Comment #26 from Vincent Lefèvre <vincent+libc at vinc17 dot org> 2011-05-04 13:29:06 UTC ---
(In reply to comment #18)
> The problem we're facing just made this fact plain: there is no reason why
> memcpy should not be memmove.

If these two functions should behave in the same way, then why not all
programmers use memmove (which has fewer requirements)?

If memcpy is called while the objects overlap, the bug is not necessarily that
memmove should have been used instead. The cause may be an incorrect size. So,
with this point of view, it should be safer to abort than letting the program
behave in an uncontrolled way.

(In reply to comment #25)
> So, again, I think we need at least a transition period so that people can
> detect and fix the issues.

But it may be difficult to detect the issues. For instance, zsh was affected by
a similar problem (now fixed in CVS only) with the optimized strcpy, but to
detect the problem, it involves keyboard input:

  http://www.zsh.org/mla/workers/2011/msg00533.html
  http://www.zsh.org/mla/workers/2011/msg00544.html

For strcpy, this is even worse, as there is no strmove function, so that either
programmers have to write non-portable code or they have to reimplement a naive
version of strcpy or find some other workaround, such as memmove + strlen:

  http://www.zsh.org/mla/workers/2011/msg00542.html

I suppose that if this has been done for memcpy, then strcpy should also be
patched in some way...

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


  parent reply	other threads:[~2011-05-04 13:32 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-25  2:26 [Bug libc/12518] New: " torvalds@linux-foundation.org
2011-02-25  2:29 ` [Bug libc/12518] " torvalds@linux-foundation.org
2011-02-25  3:57 ` hjl.tools at gmail dot com
2011-02-25  4:15 ` torvalds@linux-foundation.org
2011-02-25  9:59 ` drepper.fsp at gmail dot com
2011-02-25 11:49 ` tolzmann at molgen dot mpg.de
2011-02-25 12:07 ` jakub at redhat dot com
2011-02-25 15:20 ` hjl.tools at gmail dot com
2011-02-26  1:56 ` drepper.fsp at gmail dot com
2011-03-02  4:03 ` alexander.hunt2005 at gmail dot com
2011-03-02 20:12 ` smconvey at gmail dot com
2011-03-03 23:28 ` felipe.contreras at gmail dot com
2011-03-04  3:02 ` jvillalo at redhat dot com
2011-03-04  9:28 ` thierry.vignaud at gmail dot com
2011-03-04 16:07 ` ml-bz-dale at riyescott dot com
2011-03-04 23:42 ` drepper.fsp at gmail dot com
2011-03-04 23:54 ` torvalds@linux-foundation.org
2011-03-05  0:28 ` felipe.contreras at gmail dot com
2011-03-05 13:28 ` oliver.henshaw at gmail dot com
2011-03-12 16:38 ` tmoody at ku dot edu
2011-03-24 21:04 ` bvasselle at gmail dot com
2011-03-25  4:37 ` hjl.tools at gmail dot com
2011-03-25  6:46 ` jakub at redhat dot com
2011-03-28 11:53 ` tmraz at redhat dot com
2011-03-28 11:54 ` felipe.contreras at gmail dot com
2011-03-29 14:43 ` felipe.contreras at gmail dot com
2011-03-29 22:28 ` bvasselle at gmail dot com
2011-03-30  5:14 ` felipe.contreras at gmail dot com
2011-03-30  7:21 ` felipe.contreras at gmail dot com
2011-03-30 10:20 ` y.pronenko at gmail dot com
2011-03-31  8:37 ` shaforostoff at gmail dot com
2011-04-01 23:42 ` drepper.fsp at gmail dot com
2011-04-02  2:57 ` hjl.tools at gmail dot com
2011-04-10 15:39 ` bvasselle at gmail dot com
2011-04-10 15:50 ` felipe.contreras at gmail dot com
2011-05-04 13:32 ` vincent+libc at vinc17 dot org [this message]
2011-05-04 15:02 ` felipe.contreras at gmail dot com
2011-06-07  3:07 ` kenyon at kenyonralph dot com
2013-08-12 17:20 ` tudorb at gmail dot com
2013-08-19 23:48   ` Ondřej Bílka
2013-08-19 23:48 ` neleai at seznam dot cz
2013-08-20  1:12 ` tudorb at gmail dot com
2014-02-16 19:41 ` jackie.rosen at hushmail dot com
2014-02-16 19:54 ` kenyon at kenyonralph dot com
2014-05-28 19:41 ` schwab at sourceware dot org
2014-06-27 13:49 ` fweimer at redhat dot com
2015-02-25 10:28 ` mwest@awek-microdata.de

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=bug-12518-131-5NtzWO6GCg@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).