From: Lars Ingebrigtsen <larsi@gnus.org>
To: Fredrik Bergroth <fbergroth@gmail.com>
Cc: 19213@debbugs.gnu.org
Subject: bug#19213: 25.0.50; [PATCH] * editfns.c (Ftranspose_regions): memmove instead of memcpy
Date: Tue, 23 Feb 2016 22:41:42 +1100 [thread overview]
Message-ID: <87wppvpsax.fsf@gnus.org> (raw)
In-Reply-To: <871toncbs1.fsf@gmail.com> (Fredrik Bergroth's message of "Fri, 28 Nov 2014 21:26:06 +0100")
Fredrik Bergroth <fbergroth@gmail.com> writes:
> In one case, `memcpy' is used 4 times to transform [r1|mid|r2] into
> [r2|mid|r1], but `dest' and `src' may overlap when copying the mid
> interval, which is forbidden by `memcpy' and results in undefined
> behavior. Instead use `memmove' like other cases do.
> ---
> src/editfns.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/editfns.c b/src/editfns.c
> index 0a07886..82bd26d 100644
> --- a/src/editfns.c
> +++ b/src/editfns.c
> @@ -4898,7 +4898,7 @@ Transposing beyond buffer boundaries is an error. */)
> start2_addr = BYTE_POS_ADDR (start2_byte);
> memcpy (temp, start1_addr, len1_byte);
> memcpy (start1_addr, start2_addr, len2_byte);
> - memcpy (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
> + memmove (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
Thanks; applied to the Emacs trunk.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
prev parent reply other threads:[~2016-02-23 11:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-28 20:26 bug#19213: 25.0.50; [PATCH] * editfns.c (Ftranspose_regions): memmove instead of memcpy Fredrik Bergroth
2016-02-23 11:41 ` Lars Ingebrigtsen [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=87wppvpsax.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=19213@debbugs.gnu.org \
--cc=fbergroth@gmail.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.