mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-19 07:27:50 +08:00
b0d9d51627
Fixes #38962. Fixes #38966. - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [x] SHA512s are updated for each updated download. - [x] The "supports" clause reflects platforms that may be fixed by this new version. - [x] Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file. - [x] Any patches that are no longer applied are deleted from the port's directory. - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file. Changes: * update Qt5 to 5.15.14 following [these instructions](https://github.com/microsoft/vcpkg/pull/24660#issuecomment-1124329485). * added patch for CVE-2024-36048 to `qt5-networkauth`. * removed patch for CVE-2023-32762 from `qt5-base` as Qt 5.15.14 is no longer affected. * removed patch for CVE-2023-33285 from `qt5-base` as Qt 5.15.14 is no longer affected. * removed patch for CVE-2023-32573 from `qt5-svg` as Qt 5.15.14 is no longer affected.
54 lines
1.8 KiB
Diff
54 lines
1.8 KiB
Diff
diff --git a/src/oauth/qabstractoauth.cpp b/src/oauth/qabstractoauth.cpp
|
|
index f1ed2af..05b189a 100644
|
|
--- a/src/oauth/qabstractoauth.cpp
|
|
+++ b/src/oauth/qabstractoauth.cpp
|
|
@@ -37,7 +37,6 @@
|
|
#include <QtCore/qurl.h>
|
|
#include <QtCore/qpair.h>
|
|
#include <QtCore/qstring.h>
|
|
-#include <QtCore/qdatetime.h>
|
|
#include <QtCore/qurlquery.h>
|
|
#include <QtCore/qjsondocument.h>
|
|
#include <QtCore/qmessageauthenticationcode.h>
|
|
@@ -46,6 +45,9 @@
|
|
#include <QtNetwork/qnetworkaccessmanager.h>
|
|
#include <QtNetwork/qnetworkreply.h>
|
|
|
|
+#include <QtCore/qrandom.h>
|
|
+#include <QtCore/private/qlocking_p.h>
|
|
+
|
|
#include <random>
|
|
|
|
Q_DECLARE_METATYPE(QAbstractOAuth::Error)
|
|
@@ -290,15 +292,19 @@ void QAbstractOAuthPrivate::setStatus(QAbstractOAuth::Status newStatus)
|
|
}
|
|
}
|
|
|
|
+static QBasicMutex prngMutex;
|
|
+Q_GLOBAL_STATIC_WITH_ARGS(std::mt19937, prng, (*QRandomGenerator::system()))
|
|
+
|
|
QByteArray QAbstractOAuthPrivate::generateRandomString(quint8 length)
|
|
{
|
|
- const char characters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
- static std::mt19937 randomEngine(QDateTime::currentDateTime().toMSecsSinceEpoch());
|
|
+ constexpr char characters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
std::uniform_int_distribution<int> distribution(0, sizeof(characters) - 2);
|
|
QByteArray data;
|
|
data.reserve(length);
|
|
+ auto lock = qt_unique_lock(prngMutex);
|
|
for (quint8 i = 0; i < length; ++i)
|
|
- data.append(characters[distribution(randomEngine)]);
|
|
+ data.append(characters[distribution(*prng)]);
|
|
+ lock.unlock();
|
|
return data;
|
|
}
|
|
|
|
@@ -614,6 +620,7 @@ void QAbstractOAuth::resourceOwnerAuthorization(const QUrl &url, const QVariantM
|
|
}
|
|
|
|
/*!
|
|
+ \threadsafe
|
|
Generates a random string which could be used as state or nonce.
|
|
The parameter \a length determines the size of the generated
|
|
string.
|