summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2018-10-09 09:50:24 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2018-10-10 07:45:09 +0000
commit4dc251879c129710298ec9f9360490daed6a6a59 (patch)
treee00fe5a8f3208db68dd1ec7fc0ff0fe7798fb92b
parentba0ff45109a0eb051a42d6d8392d1f1b7a1e9345 (diff)
Ssl: Fix contrived crash when calling resume
If you, directly after connecting, call "ignoreSslErrors()" followed by "resume()" then you will most likely crash. It is very contrived and there's no reason to do this. Change-Id: I949a303238f5012296d0e84eb76173764eb9de2e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/network/ssl/qsslsocket.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 4273904c12..ee157082ea 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -388,6 +388,9 @@ QSslSocket::~QSslSocket()
*/
void QSslSocket::resume()
{
+ Q_D(QSslSocket);
+ if (!d->paused)
+ return;
// continuing might emit signals, rather do this through the event loop
QMetaObject::invokeMethod(this, "_q_resumeImplementation", Qt::QueuedConnection);
}
@@ -2573,6 +2576,7 @@ void QSslSocketPrivate::_q_resumeImplementation()
if (verifyErrorsHaveBeenIgnored()) {
continueHandshake();
} else {
+ Q_ASSERT(!sslErrors.isEmpty());
setErrorAndEmit(QAbstractSocket::SslHandshakeFailedError, sslErrors.constFirst().errorString());
plainSocket->disconnectFromHost();
return;