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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1edf0d9c59559ab91a8aa9725a54d70002bc45b805b1186d7c601e042bc2114a
4
- data.tar.gz: 8640e0da10909f2552b92bb337d7d777249271c256984ab811e887cff9d86e4f
3
+ metadata.gz: cd819b0568e9a9229a56b68b7b4c29c99dc11af026209fe9fede7e29826256fb
4
+ data.tar.gz: dc3b19894d4f6059c11ab3c8acc5c21454653563ec6d3452f1b20cc3842f4a27
5
5
  SHA512:
6
- metadata.gz: f54378fc9342220fc42cb843b1b2e0312e3bcc99269338526c38c0e3ec9f655c29ac97578d02cbdeb59e92565d60670a6a164f1ffb9dfcb4d6cc1ddfd4c5d13f
7
- data.tar.gz: 48fb3d8d3b6eab76d90df2c6850b9d322f38669cb4347ad28b7ce3536ece630289b511fd5585fb2e052e705491352190177a358e79fb13265c73fdfcc02323a6
6
+ metadata.gz: b02df17391121bfd37a15d9392aa21c3f062140ae7040199db8d5823a576a2a4a4b134e70bb891b97cd0c60dd90bbd39d263317ef302b81b863bf43c1481a99b
7
+ data.tar.gz: 3da57ea6306e19d5f3582f73031e57f4ddd2c2b9361b0d04b22a0bc6322da32e6f8e3778833955da962017757ae414eb4257f371cf8459957e5d64b56fc8dfd8
@@ -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
@@ -178,15 +178,15 @@ module PatchELF
178
178
 
179
179
  private
180
180
 
181
- def log_or_raise(msg)
182
- raise PatchELF::PatchError, msg unless @logging
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
- log_or_raise 'DYNAMIC segment not found, might be a statically-linked ELF?' if s.nil?
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module PatchELF
4
4
  # Current gem version.
5
- VERSION = '1.1.0'.freeze
5
+ VERSION = '1.1.1'.freeze
6
6
  end
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.0
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-13 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elftools