Git commit e9f68dc7a3e7bf2f47ea2b01acf529fd0e4fab1f by Kamal Mostafa. Committed on 29/02/2016 at 23:07. Pushed by mardelle into branch 'master'. Save XML files with deterministic attribute order Disable randomized QHash seed salt, so that QDomDocument will save XML attributes in a deterministic (albeit arbitrary) order. Now, saving an unchanged project yields an identical .kdenlive file which can be checksummed, diff'ed, etc. Reference: http://doc.qt.io/qt-5/qhash.html#algorithmic-complexity-attacks Reference: http://stacksolve.com/3W1nJraYm18Q/qt-5-produce-random-attribute= -order-in-xml.html M +4 -0 src/main.cpp http://commits.kde.org/kdenlive/e9f68dc7a3e7bf2f47ea2b01acf529fd0e4fab1f diff --git a/src/main.cpp b/src/main.cpp index d505962..9acef87 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,6 +37,10 @@ = int main(int argc, char *argv[]) { + // Force QDomDocument to use a deterministic XML attribute order + extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed; + qt_qhash_seed.store(0); + #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) QCoreApplication::setAttribute(Qt::AA_X11InitThreads); #endif