From 4dc251879c129710298ec9f9360490daed6a6a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 9 Oct 2018 09:50:24 +0200 Subject: 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 --- src/network/ssl/qsslsocket.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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; -- cgit v1.2.3