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>
This commit is contained in:
Mårten Nordheim 2018-10-09 09:50:24 +02:00
parent ba0ff45109
commit 4dc251879c

View File

@ -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;