elftools 1.2.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab5e28fa0f434f6bbfe67e7799ba85fdd5e66aef685c9b299e948dcac916b21a
4
- data.tar.gz: 70fbe96e62e6ebe036082959b3f0be0803bd7fe5cee42194686369d19529d35f
3
+ metadata.gz: baf5180fcccc876442fd65581828e91f8a362657f788a64c36ea7e2fbcd20c5a
4
+ data.tar.gz: 4372260ec8fc5ca97b96e14f6413ca5126c79f716446f804974f946ee06bd09f
5
5
  SHA512:
6
- metadata.gz: 52bacdbdb8de7d6f3d0c28d52b7b4e8b75c69741381ae45877f9a5424af69a4ba299e28479851defc48884147aa87ae4ab5f7c9d86a7ef5515ae895dbc284d45
7
- data.tar.gz: a06de74a09b59b5067e4d31cd12f5c377ef9dc936fe7fda3d906bd2e9107ad5d3e049914b2542a56c4cb0895b672a56d13106ad0c78c9511ae6af92e29943d15
6
+ metadata.gz: 1c5ab262e05127590f9cf1e28cc787e63db35a8fce1a9be86a55ce2e1ec813a6044a0f68d26149ad222a1cc67ef763afdf3df219b9bf8de28095f5ac4b7e9500
7
+ data.tar.gz: fea4f806def364feca723f04490f80541466d39ef7ac24fa6eb491a463baa90839d2b0bc6e1234027959abe3ec7ef6ac6874afbe8cda915570ddf6f5527e2f70
@@ -96,7 +96,7 @@ module ELFTools
96
96
  @tag_at_map ||= {}
97
97
  return @tag_at_map[n] if @tag_at_map[n]
98
98
 
99
- dyn = Structs::ELF_Dyn.new(endian: endian)
99
+ dyn = Structs::ELF_Dyn.new(endian:)
100
100
  dyn.elf_class = header.elf_class
101
101
  stream.pos = tag_start + n * dyn.num_bytes
102
102
  dyn.offset = stream.pos
@@ -36,7 +36,7 @@ module ELFTools
36
36
  return @header if defined?(@header)
37
37
 
38
38
  stream.pos = 0
39
- @header = Structs::ELF_Ehdr.new(endian: endian, offset: stream.pos)
39
+ @header = Structs::ELF_Ehdr.new(endian:, offset: stream.pos)
40
40
  @header.elf_class = elf_class
41
41
  @header.read(stream)
42
42
  end
@@ -237,7 +237,7 @@ module ELFTools
237
237
  # #=> #<ELFTools::Segments::NoteSegment:0x005629dda1e4f8>
238
238
  #
239
239
  # # this is ok
240
- # elf.segment_by_type('note') # will be tranformed into `PT_NOTE`
240
+ # elf.segment_by_type('note') # will be transformed into `PT_NOTE`
241
241
  # #=> #<ELFTools::Segments::NoteSegment:0x005629dda1e4f8>
242
242
  # @example
243
243
  # elf.segment_by_type(1337)
@@ -290,7 +290,7 @@ module ELFTools
290
290
  # elf = ELFTools::ELFFile.new(File.open('/bin/cat'))
291
291
  # elf.offset_from_vma(0x401337)
292
292
  # #=> 4919 # 0x1337
293
- def offset_from_vma(vma, size = 0)
293
+ def offset_from_vma(vma, size = 1)
294
294
  segments_by_type(:load) do |seg|
295
295
  return seg.vma_to_offset(vma) if seg.vma_in?(vma, size)
296
296
  end
@@ -358,7 +358,7 @@ module ELFTools
358
358
 
359
359
  def create_section(n)
360
360
  stream.pos = header.e_shoff + n * header.e_shentsize
361
- shdr = Structs::ELF_Shdr.new(endian: endian, offset: stream.pos)
361
+ shdr = Structs::ELF_Shdr.new(endian:, offset: stream.pos)
362
362
  shdr.elf_class = elf_class
363
363
  shdr.read(stream)
364
364
  Sections::Section.create(shdr, stream,
@@ -369,7 +369,7 @@ module ELFTools
369
369
 
370
370
  def create_segment(n)
371
371
  stream.pos = header.e_phoff + n * header.e_phentsize
372
- phdr = Structs::ELF_Phdr[elf_class].new(endian: endian, offset: stream.pos)
372
+ phdr = Structs::ELF_Phdr[elf_class].new(endian:, offset: stream.pos)
373
373
  phdr.elf_class = elf_class
374
374
  Segments::Segment.create(phdr.read(stream), stream, offset_from_vma: method(:offset_from_vma))
375
375
  end
data/lib/elftools/note.rb CHANGED
@@ -79,7 +79,7 @@ module ELFTools
79
79
  end
80
80
 
81
81
  def create_note(cur)
82
- nhdr = Structs::ELF_Nhdr.new(endian: endian, offset: stream.pos).read(stream)
82
+ nhdr = Structs::ELF_Nhdr.new(endian:, offset: stream.pos).read(stream)
83
83
  ELFTools::Note::Note.new(nhdr, stream, cur)
84
84
  end
85
85
 
@@ -26,7 +26,7 @@ module ELFTools
26
26
  @offset_from_vma = offset_from_vma
27
27
  end
28
28
 
29
- # Return +header.sh_type+ in a simplier way.
29
+ # Return +header.sh_type+ in a simpler way.
30
30
  # @return [Integer]
31
31
  # The type, meaning of types are defined in {Constants::SHT}.
32
32
  def type
@@ -20,7 +20,7 @@ module ELFTools
20
20
  @offset_from_vma = offset_from_vma
21
21
  end
22
22
 
23
- # Return +header.p_type+ in a simplier way.
23
+ # Return +header.p_type+ in a simpler way.
24
24
  # @return [Integer]
25
25
  # The type, meaning of types are defined in {Constants::PT}.
26
26
  def type
@@ -35,19 +35,19 @@ module ELFTools
35
35
  end
36
36
 
37
37
  # Is this segment readable?
38
- # @return [Boolean] Ture or false.
38
+ # @return [Boolean] True or false.
39
39
  def readable?
40
40
  (header.p_flags & 4) == 4
41
41
  end
42
42
 
43
43
  # Is this segment writable?
44
- # @return [Boolean] Ture or false.
44
+ # @return [Boolean] True or false.
45
45
  def writable?
46
46
  (header.p_flags & 2) == 2
47
47
  end
48
48
 
49
49
  # Is this segment executable?
50
- # @return [Boolean] Ture or false.
50
+ # @return [Boolean] True or false.
51
51
  def executable?
52
52
  (header.p_flags & 1) == 1
53
53
  end
data/lib/elftools/util.rb CHANGED
@@ -5,7 +5,7 @@ module ELFTools
5
5
  module Util
6
6
  # Class methods.
7
7
  module ClassMethods
8
- # Round up the number to be mulitple of
8
+ # Round up the number to be multiple of
9
9
  # +2**bit+.
10
10
  # @param [Integer] num Number to be rounded-up.
11
11
  # @param [Integer] bit How many bit to be aligned.
@@ -2,5 +2,5 @@
2
2
 
3
3
  module ELFTools
4
4
  # Current gem version
5
- VERSION = '1.2.0'
5
+ VERSION = '1.3.1'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elftools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - david942j
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-13 00:00:00.000000000 Z
11
+ date: 2024-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -169,14 +169,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - ">="
171
171
  - !ruby/object:Gem::Version
172
- version: '2.6'
172
+ version: '3.1'
173
173
  required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  requirements:
175
175
  - - ">="
176
176
  - !ruby/object:Gem::Version
177
177
  version: '0'
178
178
  requirements: []
179
- rubygems_version: 3.1.6
179
+ rubygems_version: 3.5.3
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: ELFTools - Pure ruby library for parsing and patching ELF files