Skip to content

Commit

Permalink
Fix off-by-one in offset_from_vma (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Apr 21, 2024
1 parent 266c3a1 commit e5677a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/elftools/elf_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def segment_at(n)
# elf = ELFTools::ELFFile.new(File.open('/bin/cat'))
# elf.offset_from_vma(0x401337)
# #=> 4919 # 0x1337
def offset_from_vma(vma, size = 0)
def offset_from_vma(vma, size = 1)
segments_by_type(:load) do |seg|
return seg.vma_to_offset(vma) if seg.vma_in?(vma, size)
end
Expand Down

0 comments on commit e5677a0

Please sign in to comment.