summaryrefslogtreecommitdiffstats
path: root/meta/lib
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:17:10 +0000
commit334e1b5e0ee52f201379aee2d3b4d39943ee19e4 (patch)
tree298ca217bcb8051d294e31eb8e889150a528cbf2 /meta/lib
parent11359e9d5db948cf981228abe0020ce20087eb26 (diff)
downloadpoky-334e1b5e0ee52f201379aee2d3b4d39943ee19e4.tar.gz
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>
Diffstat (limited to 'meta/lib')
-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:
31 self.objdump_output = {} 31 self.objdump_output = {}
32 32
33 def open(self): 33 def open(self):
34 if not os.path.isfile(self.name):
35 raise Exception("File is not a normal file")
36
34 self.file = file(self.name, "r") 37 self.file = file(self.name, "r")
35 self.data = self.file.read(ELFFile.EI_NIDENT+4) 38 self.data = self.file.read(ELFFile.EI_NIDENT+4)
36 39