diff options
| author | Brian Potchik <brian@vector35.com> | 2025-07-12 21:18:14 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2025-07-12 21:18:14 -0400 |
| commit | 6c4619c0e3216f51f6e69071c7ce2a3e909b6a74 (patch) | |
| tree | 4cf4c611bacc212196ea8563c2f5f35e9fda2917 /binaryview.cpp | |
| parent | aa9ab3be6d50b13157472ab10f9f82f3e74e16c1 (diff) | |
Fix GetDataOffsetForAddress API to properly work for mapped load regions only.
Diffstat (limited to 'binaryview.cpp')
| -rw-r--r-- | binaryview.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/binaryview.cpp b/binaryview.cpp index 6585f5c4..433767c0 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -5038,9 +5038,8 @@ bool BinaryView::GetAddressForDataOffset(uint64_t offset, uint64_t& addr) bool BinaryView::GetDataOffsetForAddress(uint64_t addr, uint64_t& offset) { auto segment = GetSegmentAt(addr); - if (segment && segment->GetStart() <= addr && addr < segment->GetEnd()) + if (segment && segment->GetDataLength() && (segment->GetStart() <= addr) && (addr < segment->GetEnd())) { - offset = 0; offset = addr - segment->GetStart() + segment->GetDataOffset(); return true; } |
