diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2010-08-30 13:43:01 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2010-08-30 13:55:57 (GMT) |
commit | d686a95ed54b19336affc14c9222de54c9af0e72 (patch) | |
tree | 3b8051ecb9ede44324deba7814482ca40b5ed67c /tests | |
parent | e32d8cd49c4e3137889512e3f3a19018b4195970 (diff) | |
download | Qt-d686a95ed54b19336affc14c9222de54c9af0e72.zip Qt-d686a95ed54b19336affc14c9222de54c9af0e72.tar.gz Qt-d686a95ed54b19336affc14c9222de54c9af0e72.tar.bz2 |
QSslConfiguration: fix crash when accessing null pointer
We were accessing the d-pointer of a QSslConfiguration which is
initialized lazily.
Reviewed-by: Markus Goetz
Task-number: QTBUG-13265
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qsslsocket/tst_qsslsocket.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 6c1dd8f..d6a7a01 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -183,6 +183,7 @@ private slots: void ignoreSslErrorsListWithSlot(); void readFromClosedSocket(); void writeBigChunk(); + void setEmptyDefaultConfiguration(); static void exitLoop() { @@ -1835,6 +1836,21 @@ void tst_QSslSocket::writeBigChunk() socket->close(); } +void tst_QSslSocket::setEmptyDefaultConfiguration() +{ + // used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265 + + if (!QSslSocket::supportsSsl()) + return; + + QSslConfiguration emptyConf; + QSslConfiguration::setDefaultConfiguration(emptyConf); + + QSslSocketPtr socket = newSocket(); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslSocket) |