mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 00:32:13 +02:00
lib/oe/qa: ELFFile: check that a path is a file before opening it
When opening an ELF file check that a filename points to a normal file before attempting to open it, as if the file turns out to be something more exotic like a FIFO it could hang forever. (From OE-Core rev: 4b3576bc30d8f8cdcde25189def8b059fc92b27c) (From OE-Core rev: d3af2058e2753516b9aaf7f6d71162363eea11d4) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
11359e9d5d
commit
334e1b5e0e
@@ -31,6 +31,9 @@ class ELFFile:
|
||||
self.objdump_output = {}
|
||||
|
||||
def open(self):
|
||||
if not os.path.isfile(self.name):
|
||||
raise Exception("File is not a normal file")
|
||||
|
||||
self.file = file(self.name, "r")
|
||||
self.data = self.file.read(ELFFile.EI_NIDENT+4)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user