patchelf 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/patchelf/exceptions.rb +4 -0
- data/lib/patchelf/patcher.rb +7 -5
- data/lib/patchelf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd819b0568e9a9229a56b68b7b4c29c99dc11af026209fe9fede7e29826256fb
|
4
|
+
data.tar.gz: dc3b19894d4f6059c11ab3c8acc5c21454653563ec6d3452f1b20cc3842f4a27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b02df17391121bfd37a15d9392aa21c3f062140ae7040199db8d5823a576a2a4a4b134e70bb891b97cd0c60dd90bbd39d263317ef302b81b863bf43c1481a99b
|
7
|
+
data.tar.gz: 3da57ea6306e19d5f3582f73031e57f4ddd2c2b9361b0d04b22a0bc6322da32e6f8e3778833955da962017757ae414eb4257f371cf8459957e5d64b56fc8dfd8
|
data/lib/patchelf/exceptions.rb
CHANGED
@@ -6,4 +6,8 @@ require 'elftools/exceptions'
|
|
6
6
|
module PatchELF
|
7
7
|
# Raised on an error during ELF modification.
|
8
8
|
class PatchError < ELFTools::ELFError; end
|
9
|
+
# Raised when Dynamic Tag is missing
|
10
|
+
class MissingTagError < PatchError; end
|
11
|
+
# Raised on missing Program Header(segment)
|
12
|
+
class MissingSegmentError < PatchError; end
|
9
13
|
end
|
data/lib/patchelf/patcher.rb
CHANGED
@@ -178,15 +178,15 @@ module PatchELF
|
|
178
178
|
|
179
179
|
private
|
180
180
|
|
181
|
-
def log_or_raise(msg)
|
182
|
-
raise
|
181
|
+
def log_or_raise(msg, exception = PatchELF::PatchError)
|
182
|
+
raise exception, msg unless @logging
|
183
183
|
|
184
184
|
PatchELF::Logger.warn(msg)
|
185
185
|
end
|
186
186
|
|
187
187
|
def interpreter_
|
188
188
|
segment = @elf.segment_by_type(:interp)
|
189
|
-
return log_or_raise 'No interpreter found.' if segment.nil?
|
189
|
+
return log_or_raise 'No interpreter found.', PatchELF::MissingSegmentError if segment.nil?
|
190
190
|
|
191
191
|
segment.interp_name
|
192
192
|
end
|
@@ -219,14 +219,16 @@ module PatchELF
|
|
219
219
|
return if segment.nil?
|
220
220
|
|
221
221
|
tag = segment.tag_by_type(type)
|
222
|
-
return log_or_raise log_msg if tag.nil?
|
222
|
+
return log_or_raise log_msg, PatchELF::MissingTagError if tag.nil?
|
223
223
|
|
224
224
|
tag.name
|
225
225
|
end
|
226
226
|
|
227
227
|
def dynamic_or_log
|
228
228
|
@elf.segment_by_type(:dynamic).tap do |s|
|
229
|
-
|
229
|
+
if s.nil?
|
230
|
+
log_or_raise 'DYNAMIC segment not found, might be a statically-linked ELF?', PatchELF::MissingSegmentError
|
231
|
+
end
|
230
232
|
end
|
231
233
|
end
|
232
234
|
end
|
data/lib/patchelf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patchelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- david942j
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elftools
|