Skip to content
Snippets Groups Projects
Commit 5c068ef8 authored by Michka Popoff's avatar Michka Popoff
Browse files

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
parent d8c6f6b1
No related branches found
No related tags found
No related merge requests found
......@@ -133,8 +133,10 @@ module ELFShim
soname = nil
needed = []
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|
next if s.start_with?("readelf: Warning: possibly corrupt ELF header")
filename = s[/\[(.*)\]/, 1]
next if filename.nil?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment