elftools 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elftools/dynamic.rb +1 -1
- data/lib/elftools/elf_file.rb +4 -4
- data/lib/elftools/note.rb +1 -1
- data/lib/elftools/sections/section.rb +1 -1
- data/lib/elftools/segments/segment.rb +4 -4
- data/lib/elftools/util.rb +1 -1
- data/lib/elftools/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e00adcca6952a55f4ef4ebc5ced332606021363f7efd625959b292376cbb42f4
|
4
|
+
data.tar.gz: 26e3bc5136af88ccc5f5d6c312b4f8db53a93c4b41db122ab334ee0a54a288d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62a968561ed825a1f1a8b7cc6df80086aa3b002af9905d691a71cbff54d42634d9870966b643c21849f20b339b9074aa8c234800504bc205b1c8d7830ad279af
|
7
|
+
data.tar.gz: 0ad963ae8c7727694dd7da1579ff38a94db270a19636e32a500526a4164f9be55b4a91abbb87f56a1ce401a8f50f83fde20e11620605873cb5a1d9f4dd33ee85
|
data/lib/elftools/dynamic.rb
CHANGED
@@ -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:
|
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
|
data/lib/elftools/elf_file.rb
CHANGED
@@ -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
|
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
|
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)
|
@@ -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
|
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
|
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
|
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
|
|
@@ -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
|
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]
|
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]
|
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]
|
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
|
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.
|
data/lib/elftools/version.rb
CHANGED
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- david942j
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-17 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: '
|
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.
|
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
|