summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2016-02-08 20:35:40 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-16 11:16:49 +0000
commitd3af2058e2753516b9aaf7f6d71162363eea11d4 (patch)
tree6a726b9e2a2ab1a746172b125d8c90efc065a07c
parent94ecc846f9b33fcec039936643c49728eedfefb7 (diff)
downloadopenembedded-core-contrib-d3af2058e2753516b9aaf7f6d71162363eea11d4.tar.gz
openembedded-core-contrib-d3af2058e2753516b9aaf7f6d71162363eea11d4.tar.bz2
openembedded-core-contrib-d3af2058e2753516b9aaf7f6d71162363eea11d4.zip
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) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/qa.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index d5cdaa0fcd..21fb9977ce 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -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)