From 3bdb5e9cc9c807753beb04ec6cb6ad0eeea98a3b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 31 Jul 2023 14:27:34 -0700 Subject: [PATCH] QElfParser: handle the case of PN_XNUM program headers This is an extension point when you have more than 65535 program headers. Hopefully no one has that many. Change-Id: Ifbf974a4d10745b099b1fffd177710fae9c31b97 Reviewed-by: Volker Hilsheimer --- src/corelib/plugin/qelfparser_p.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp index ffc4a14be0a..f994b9970f1 100644 --- a/src/corelib/plugin/qelfparser_p.cpp +++ b/src/corelib/plugin/qelfparser_p.cpp @@ -539,6 +539,8 @@ static bool preScanProgramHeaders(QByteArrayView data, const ErrorMaker &error) // first, validate the extent of the full program header table T::Word e_phnum = header->e_phnum; + if (e_phnum == PN_XNUM) + return error(QLibrary::tr("unimplemented: PN_XNUM program headers")), false; T::Off offset = e_phnum * sizeof(T::Phdr); // can't overflow due to size of T::Half if (qAddOverflow(offset, header->e_phoff, &offset) || offset > size_t(data.size())) return error(QLibrary::tr("program header table extends past the end of the file")), false;