tst_QSslSocket - stop using qrand (to suppress a warning)
Whoever wrote this test, was a PROPER hacker: trying to force a TLS implementation not to properly compress some data, they generated a sequence of bytes in a very fancy manner, something like 255 0 0 0 255 0 0 0 123 0 0 0 255 0 0 0 - yeah, it's really a random sequence of bytes, surely, it's impossible to compress! Meh. Pick-to: 5.15 Change-Id: Ia10ae18a40b5b8f006c45147b06fe5be6efcb129 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
ad532ce118
commit
7d98964815
@ -30,6 +30,7 @@
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qthread.h>
|
||||
#include <QtCore/qelapsedtimer.h>
|
||||
#include <QtCore/qrandom.h>
|
||||
#include <QtNetwork/qhostaddress.h>
|
||||
#include <QtNetwork/qhostinfo.h>
|
||||
#include <QtNetwork/qnetworkproxy.h>
|
||||
@ -2627,13 +2628,11 @@ void tst_QSslSocket::writeBigChunk()
|
||||
socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443);
|
||||
|
||||
QByteArray data;
|
||||
data.resize(1024*1024*10); // 10 MB
|
||||
// init with garbage. needed so ssl cannot compress it in an efficient way.
|
||||
// ### Qt 6: update to a random engine
|
||||
for (size_t i = 0; i < data.size() / sizeof(int); i++) {
|
||||
int r = qrand();
|
||||
data.data()[i*sizeof(int)] = r;
|
||||
}
|
||||
// Originally, the test had this: '1024*1024*10; // 10 MB'
|
||||
data.resize(1024 * 1024 * 10);
|
||||
// Init with garbage. Needed so TLS cannot compress it in an efficient way.
|
||||
QRandomGenerator::global()->fillRange(reinterpret_cast<quint32 *>(data.data()),
|
||||
data.size() / int(sizeof(quint32)));
|
||||
|
||||
if (!socket->waitForEncrypted(10000))
|
||||
QSKIP("Skipping flaky test - See QTBUG-29941");
|
||||
|
Loading…
x
Reference in New Issue
Block a user