mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-07-30 07:44:13 +02:00
Harden QDom serialization against invalid data (CVE-2026-15037)
Set QDomImplementation::setInvalidDataPolicy(ReturnNullNode) at startup. Qt before 6.12 defaults to accepting invalid data when building QDom nodes, so untrusted text inserted into comments, CDATA sections or processing instructions could break out of its node on serialization (XML injection, low severity). Qt 6.12 flips the default to ReturnNullNode; opting in explicitly gives the same behavior on any Qt 5/6 version, so no version guard is needed. Verified: --resave of a 5-folio project produces valid XML with all folios intact, and --export-pdf still works on the result. (cherry picked from commit 7804ef3864a0b8643cfe13b68b8e0e6235508ab6)
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "utils/qetsettings.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDomImplementation>
|
||||
|
||||
#include <QStyleFactory>
|
||||
#include <QtConcurrentRun>
|
||||
@@ -207,6 +208,12 @@ int main(int argc, char **argv)
|
||||
QCoreApplication::setOrganizationName("QElectroTech");
|
||||
QCoreApplication::setOrganizationDomain("qelectrotech.org");
|
||||
QCoreApplication::setApplicationName("QElectroTech");
|
||||
|
||||
// Refuse invalid data when building QDom documents instead of
|
||||
// serializing malformed XML (CVE-2026-15037). This is the default
|
||||
// from Qt 6.12 on; opt in explicitly for older Qt 5/6.
|
||||
QDomImplementation::setInvalidDataPolicy(
|
||||
QDomImplementation::ReturnNullNode);
|
||||
//Creation and execution of the application
|
||||
//HighDPI
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||
|
||||
Reference in New Issue
Block a user