mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-08 18:02:05 +03:00
getdeps: dyndeps: gracefully handle empty files
Summary: Don't error out if we can't read the ELF/MACH-O header; just treat it is not an object. Reviewed By: chadaustin, simpkins Differential Revision: D19253434 fbshipit-source-id: c5ecc7f0bc7a20e2611b7e2ff754355155f095da
This commit is contained in:
committed by
Facebook Github Bot
parent
9733a79287
commit
31d721301c
@@ -251,7 +251,10 @@ class MachDeps(DepBase):
|
|||||||
with open(objfile, "rb") as f:
|
with open(objfile, "rb") as f:
|
||||||
# mach stores the magic number in native endianness,
|
# mach stores the magic number in native endianness,
|
||||||
# so unpack as native here and compare
|
# so unpack as native here and compare
|
||||||
magic = unpack("I", f.read(4))[0]
|
header = f.read(4)
|
||||||
|
if len(header) != 4:
|
||||||
|
return False
|
||||||
|
magic = unpack("I", header)[0]
|
||||||
return magic == MACH_MAGIC
|
return magic == MACH_MAGIC
|
||||||
|
|
||||||
def list_dynamic_deps(self, objfile):
|
def list_dynamic_deps(self, objfile):
|
||||||
|
Reference in New Issue
Block a user