summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qmachparser.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-09-25 10:19:06 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-10-04 21:51:50 -0700
commit2549a88ba2a48fa2bedce97dd71a2974c6f8840a (patch)
tree1d400ebbdad3562bd6bb7bd86ab48f2dc7dba666 /src/corelib/plugin/qmachparser.cpp
parentb07345504c7a5537bb09b1d5763ca192eaeaf067 (diff)
QPlugin: pass the direct header to qJsonFromRawLibraryMetaData()
This is done in preparation for storing the metadata without the magic string in static plugins and in ELF notes. Change-Id: I3eb1bd30e0124f89a052fffd16a820454dd56d3e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/plugin/qmachparser.cpp')
-rw-r--r--src/corelib/plugin/qmachparser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/plugin/qmachparser.cpp b/src/corelib/plugin/qmachparser.cpp
index 88462b97b20..82dc4bf1c28 100644
--- a/src/corelib/plugin/qmachparser.cpp
+++ b/src/corelib/plugin/qmachparser.cpp
@@ -194,8 +194,12 @@ QLibraryScanResult QMachOParser::parse(const char *m_s, ulong fdlen, QString *e
|| Q_UNLIKELY(fdlen < sect[j].offset + sect[j].size))
return notfound(QString(), errorString);
+ if (sect[j].size < sizeof(QPluginMetaData::MagicHeader))
+ return notfound(QLibrary::tr("section .qtmetadata is too small"), errorString);
+
qsizetype pos = reinterpret_cast<const char *>(header) - m_s + sect[j].offset;
- return { pos, qsizetype(sect[j].size) };
+ pos += sizeof(QPluginMetaData::MagicString);
+ return { pos, qsizetype(sect[j].size - sizeof(QPluginMetaData::MagicString)) };
}
}