This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix memory access violation when attempting to shorten a suffixed micromips instruction during looku


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=39334a61e63321352304cbae77b37fcba4fed662

commit 39334a61e63321352304cbae77b37fcba4fed662
Author: A. Wilcox <awilfox@adelielinux.org>
Date:   Thu Feb 22 12:49:49 2018 +0000

    Fix memory access violation when attempting to shorten a suffixed micromips instruction during lookup.
    
    	PR 22014
    	* config/tc-mips.c (mips_lookup_insn): Use memmove to strip the
    	instruction size suffix.

Diff:
---
 gas/ChangeLog        | 6 ++++++
 gas/config/tc-mips.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 07e3574..ce7e258 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2018-02-22  A. Wilcox  <awilfox@adelielinux.org>
+
+	PR 22014
+	* config/tc-mips.c (mips_lookup_insn): Use memmove to strip the
+	instruction size suffix.
+
 2018-02-20  Maciej W. Rozycki  <macro@mips.com>
 
 	* testsuite/gas/mips/mips16-branch-reloc-4.d: New test.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index fca0dea..6c68395 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -13955,7 +13955,7 @@ mips_lookup_insn (struct hash_control *hash, const char *start,
 	suffix = 0;
       if (suffix)
 	{
-	  memcpy (name + opend - 2, name + opend, length - opend + 1);
+	  memmove (name + opend - 2, name + opend, length - opend + 1);
 	  insn = (struct mips_opcode *) hash_find (hash, name);
 	  if (insn)
 	    {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]