From: Ross Burton Date: Mon, 8 Feb 2016 20:35:40 +0000 (+0000) Subject: lib/oe/qa: ELFFile: check that a path is a file before opening it X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~26966 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3af2058e2753516b9aaf7f6d71162363eea11d4;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 Signed-off-by: Richard Purdie --- diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py index d5cdaa0fcdb..21fb9977ced 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)