diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-05-30 20:39:40 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-05-30 20:39:40 +0200 |
commit | 683a499ebbb3d5e8803feeab9097930a9ce91d3f (patch) | |
tree | 2f8d3aa26a6f35cc2713071b9c2013d421504ca3 /src/resolve-system-dependencies | |
parent | acc889c82179e96537ebe1494ec13b9536d579ca (diff) |
resolve-system-dependencies: Fix another segfault
runResolver() was barfing on directories like
/System/Library/Frameworks/Security.framework/Versions/Current/PlugIns. It
should probably do something sophisticated for frameworks, but let's
ignore them for now.
Diffstat (limited to 'src/resolve-system-dependencies')
-rw-r--r-- | src/resolve-system-dependencies/resolve-system-dependencies.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/resolve-system-dependencies/resolve-system-dependencies.cc b/src/resolve-system-dependencies/resolve-system-dependencies.cc index 615042986..b04595732 100644 --- a/src/resolve-system-dependencies/resolve-system-dependencies.cc +++ b/src/resolve-system-dependencies/resolve-system-dependencies.cc @@ -53,6 +53,11 @@ std::set<std::string> runResolver(const Path & filename) if (fstat(fd.get(), &st)) throw SysError("statting ‘%s’", filename); + if (!S_ISREG(st.st_mode)) { + printError("file ‘%s’ is not a regular file", filename); + return {}; + } + if (st.st_size < sizeof(mach_header_64)) { printError("file ‘%s’ is too short for a MACH binary", filename); return {}; |