Skip to content

Conversation

mrexodia
Copy link
Member

@mrexodia mrexodia commented Jul 4, 2025

Reverts #3588, see closes #3615

@mrexodia
Copy link
Member Author

mrexodia commented Jul 4, 2025

@OldGamesCracking it looks like your fix might not have been correct after all 😔

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Memory Page Search Exclusion Bug

The condition page.address >= addr incorrectly excludes memory pages that start before the search address but extend into or contain the search region. This causes the pattern search to miss potential matches within these pages, including the page containing the search's starting address.

src/dbg/commands/cmd-searching.cpp#L329-L330

if(page.address >= addr && (find_size == -1 || page.address + page.size <= addr + find_size))

Fix in CursorFix in Web


BugBot free trial expires on July 22, 2025
You have used $0.00 of your $10.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

@mrexodia mrexodia merged commit bcdb5c5 into development Jul 4, 2025
6 checks passed
@mrexodia mrexodia deleted the revert-3588-fix-addr-cbInstrFindAllMem branch July 4, 2025 19:22
@OldGamesCracking
Copy link
Contributor

Maybe I'm missing something here, or things work different than how I think they do, but let's assume the following:

page.address = 1000
page.size = 100
addr = 1001
find_size = 1

So I want to start my search 1 byte into the page. But with the first part page.address >= addr, the page would not get pushed into searchPages.

Ok, let's assume page.address >= addr was correct and we would have the following situation:

page.address = 1000
page.size = 100
addr = 999
find_size = 10

Then page.address >= addr would be true, but page.address + page.size <= addr + find_size (1000 + 100 <= 999 + 10) would be false (for a non-global search).

Are we dealing with multiple problems here or am I just stupid? (both may be true)

Let's step back for a moment, this is what I would have written (somewhat explicitly)

if ((page.address + page.size) < addr)
{
  // In either case the page is below the searchrange, exclude it
  continue;
}

if (find_size == -1)
{
  // Unlimited range (only limited by start address)
  // at least (page.address + page.size) <= addr is true
  // add page
}
else
{
  // Limited range

  if ((addr + find_size) < page.address)
  {
    // Page is beyond searchrange, exclude it
    continue;

  }
  else
  {
    // The searchrange extends into the page, add it
  }
}

searchPages.push_back(page);

There is a catch though: The searchpattern can now be found within the range [page.address ... addr], so some additional filtering of the results is needed, but the same applies to [addr + find_size ... page.address + page.size]

@OldGamesCracking
Copy link
Contributor

I was actually not fully wrong, but also not fully right, I hope #3628 fixes the problem now for both cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find pattern in current module does not have 'start from selection' checkbox
2 participants