public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "chris at cmears dot id dot au" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/10783] New: search_simple_memory miscalculates its read address for multiple search chunks
Date: Thu, 15 Oct 2009 15:31:00 -0000	[thread overview]
Message-ID: <20091015153110.10783.chris@cmears.id.au> (raw)

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.


             reply	other threads:[~2009-10-15 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 15:31 chris at cmears dot id dot au [this message]
2009-10-15 15:45 ` [Bug gdb/10783] " pedro at codesourcery dot com
2009-10-29 20:12 ` cvs-commit at gcc dot gnu dot org
2009-10-29 20:15 ` sandra at codesourcery dot com

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=20091015153110.10783.chris@cmears.id.au \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).