Skip to content

Commit 5b75822

Browse files
godlygeekpablogsal
authored andcommitted
Fix a range check when reading from ELF files
The end address is exclusive, not inclusive. This off-by-one could mean that we look at the wrong shared library for a given address if it occurs at the very start of start of a mapping. Signed-off-by: Pablo Galindo <[email protected]>
1 parent c3ef08a commit 5b75822

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pystack/_pystack/mem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ CorefileRemoteMemoryManager::getMemoryLocationFromElf(
464464
off_t* offset_in_file) const
465465
{
466466
auto shared_libs_it = std::find_if(d_shared_libs.cbegin(), d_shared_libs.cend(), [&](auto& map) {
467-
return map.start <= addr && addr <= map.end;
467+
return map.start <= addr && addr < map.end;
468468
});
469469

470470
if (shared_libs_it == d_shared_libs.cend()) {

0 commit comments

Comments
 (0)