reloc: run fix_sharedlib() only on application/x-sharedlib and application/x-pie-executable

We need to prevent to run fix_sharedlib() on non-ELF files.

Fixes #4415

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20190409114941.28276-1-syuu@scylladb.com>
This commit is contained in:
Takuya ASADA
2019-04-09 20:49:41 +09:00
committed by Avi Kivity
parent 1f009b5e9b
commit e3a5ac2945

View File

@@ -157,7 +157,7 @@ def copy_file_to_python_env(ar, f):
ar.add(os.path.realpath(f), arcname=libfile)
else:
m = magic.detect_from_filename(f)
if m and m.mime_type.startswith('application/'):
if m and (m.mime_type.startswith('application/x-sharedlib') or m.mime_type.startswith('application/x-pie-executable')):
fix_sharedlib(ar, f, libfile)
else:
# in case this is a directory that is listed, we don't want to include everything that is in that directory