[prev in list] [next in list] [prev in thread] [next in thread] 

List:       binutils
Subject:    PATCH: PR gas/11456: stabs related buffer bug
From:       "H.J. Lu" <hongjiu.lu () intel ! com>
Date:       2010-03-30 23:17:05
Message-ID: 20100330231705.GA9544 () intel ! com
[Download RAW message or body]

Hi,

partial_where may point to the middle of buffer_start as seen around
line 391 in input-scrub.c.  We can't use memcpy to copy overlap memory.
We have to use memmove.  I will check this as an obvious fix.


H.J.
---
2010-03-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/11456
	* input-scrub.c (input_scrub_next_buffer): Use memmove instead
	of memcpy to copy overlap memory.

diff --git a/gas/input-scrub.c b/gas/input-scrub.c
index a2cd31b..e1ff5cc 100644
--- a/gas/input-scrub.c
+++ b/gas/input-scrub.c
@@ -343,8 +343,8 @@ input_scrub_next_buffer (char **bufp)
 
   if (partial_size)
     {
-      memcpy (buffer_start + BEFORE_SIZE, partial_where,
-	      (unsigned int) partial_size);
+      memmove (buffer_start + BEFORE_SIZE, partial_where,
+	       (unsigned int) partial_size);
       memcpy (buffer_start + BEFORE_SIZE, save_source, AFTER_SIZE);
     }
   limit = input_file_give_next_buffer (buffer_start

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic