From d5000e82e3d17532b76d5a69fd35ac4e8f3b9d18 Mon Sep 17 00:00:00 2001 From: "Arvid E. Picciani" Date: Tue, 15 May 2012 12:29:53 +0200 Subject: QElfParser: double check section size before using it. In rare cases, if the section is empty, we're reading the whole object into memory because size -1 = UINT_MAX. Change-Id: Ibf9a1534159ce626e4f2327536076d0cc1ebf0ba Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/corelib/plugin/qelfparser_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/plugin/qelfparser_p.cpp') diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp index af2fc44d00..e4215dc39b 100644 --- a/src/corelib/plugin/qelfparser_p.cpp +++ b/src/corelib/plugin/qelfparser_p.cpp @@ -218,7 +218,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library continue; } - if (sh.offset == 0 || (sh.offset + sh.size) > fdlen) { + if (sh.offset == 0 || (sh.offset + sh.size) > fdlen || sh.size < 1) { if (lib) lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library) .arg(QLatin1String("missing section data. This is not a library.")); -- cgit v1.2.3