This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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]

[Bug gdb/10783] New: search_simple_memory miscalculates its read address for multiple search chunks


The search_simple_memory function in gdb/target.c has an error that leads to
incorrect reporting of found patterns.  The problem occurs only when the search
space length is larger than the chunk size.  I believe the cause is a simple
mixup of variables.

I think the following change should fix it.

--- orig/gdb-7.0/gdb/target.c	2009-09-16 02:16:40.000000000 +1000
+++ fixed/gdb-7.0/gdb/target.c	2009-10-16 02:10:35.000000000 +1100
@@ -2302,7 +2302,7 @@ simple_search_memory (struct target_ops 
       if (search_space_len >= pattern_len)
 	{
 	  unsigned keep_len = search_buf_size - chunk_size;
-	  CORE_ADDR read_addr = start_addr + keep_len;
+	  CORE_ADDR read_addr = start_addr + chunk_size;
 	  int nr_to_read;
 
 	  /* Copy the trailing part of the previous iteration to the front

-- 
           Summary: search_simple_memory miscalculates its read address for
                    multiple search chunks
           Product: gdb
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gdb
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: chris at cmears dot id dot au
                CC: gdb-prs at sourceware dot org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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