From 683a499ebbb3d5e8803feeab9097930a9ce91d3f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 30 May 2017 20:39:40 +0200 Subject: [PATCH] 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. --- .../resolve-system-dependencies.cc | 5 +++++ 1 file changed, 5 insertions(+) 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 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 {};