Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure we don't use binary on EmptyType with lief #4900

Merged
merged 4 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions conda_build/os_utils/liefldd.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ def get_runpaths_or_rpaths_raw(file):

def set_rpath(old_matching, new_rpath, file):
binary = ensure_binary(file)
if not binary:
return
if binary.format == lief.EXE_FORMATS.ELF and (
binary.type == lief.ELF.ELF_CLASS.CLASS32
or binary.type == lief.ELF.ELF_CLASS.CLASS64
Expand Down Expand Up @@ -343,7 +345,9 @@ def _get_path_dirs(prefix):

def get_uniqueness_key(file):
binary = ensure_binary(file)
if binary.format == lief.EXE_FORMATS.MACHO:
if not binary:
return lief.EXE_FORMATS.UNKNOWN
elif binary.format == lief.EXE_FORMATS.MACHO:
return binary.name
elif binary.format == lief.EXE_FORMATS.ELF and ( # noqa
binary.type == lief.ELF.ELF_CLASS.CLASS32
Expand Down Expand Up @@ -463,7 +467,9 @@ def inspect_linkages_lief(
sysroot = _trim_sysroot(sysroot)

default_paths = []
if binary.format == lief.EXE_FORMATS.ELF:
if not binary:
default_paths = []
elif binary.format == lief.EXE_FORMATS.ELF:
if binary.type == lief.ELF.ELF_CLASS.CLASS64:
default_paths = [
"$SYSROOT/lib64",
Expand Down Expand Up @@ -491,6 +497,8 @@ def inspect_linkages_lief(
filename2 = element[0]
binary = element[1]
uniqueness_key = get_uniqueness_key(binary)
if not binary:
continue
if uniqueness_key not in already_seen:
parent_exe_dirname = None
if binary.format == lief.EXE_FORMATS.PE:
Expand Down
19 changes: 19 additions & 0 deletions news/4787-fix-leaf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Fixed handling of unknown binaries with newer (py)lief versions. (#4900)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>