elf.rb: avoid corrupted elf files
Some elf files like unittest files or memory dumps may not be completely readable by readelf. Readelf will fail after the following message: readelf: Warning: possibly corrupt ELF header - it has a non-zero program header offset, but no program headers This patches avoid these files when there is a non zero offset but no program headers
This commit is contained in:
parent
d8c6f6b120
commit
5c068ef82c
@ -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?
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user