Merge pull request #5696 from iMichka/elf

elf.rb: avoid corrupted elf files
This commit is contained in:
Michka Popoff 2019-03-10 22:46:54 +01:00 committed by GitHub
commit 27ec98dfd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,8 +133,10 @@ module ELFShim
soname = nil soname = nil
needed = [] needed = []
command = ["readelf", "-d", path.expand_path.to_s] command = ["readelf", "-d", path.expand_path.to_s]
lines = Utils.safe_popen_read(*command).split("\n") lines = Utils.popen_read(*command, err: :out).split("\n")
lines.each do |s| lines.each do |s|
next if s.start_with?("readelf: Warning: possibly corrupt ELF header")
filename = s[/\[(.*)\]/, 1] filename = s[/\[(.*)\]/, 1]
next if filename.nil? next if filename.nil?