From d90ad97e8b7589902025620e251c29023f1bc0e1 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 23 Feb 2023 14:44:49 +0100 Subject: [PATCH] QCryptographicHash: move result.clear() to beginning of reset() ... from the end(). It was lonely down there, and prone to be overlooked when performing early returns in the #ifdef'ery above, as witnessed by the early returns in the OpenSSL3 code. Amends 1fe74c3bd3f727551b8168ee9f3e642d42233d55, itself amending 633c1365966eda89fc883c039683a727d0a0813e. Change-Id: I8c941ecb5c4755d8823b2161544cf6f7fe75a239 Reviewed-by: Thiago Macieira (cherry picked from commit 9a18ca59ffc93b6e4b18a64c624ab396e3976f60) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/tools/qcryptographichash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index 3b1208be7ac..e1dcf6fd293 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -460,6 +460,7 @@ QCryptographicHash::Algorithm QCryptographicHash::algorithm() const noexcept void QCryptographicHashPrivate::reset() noexcept { + result.clear(); #ifdef USING_OPENSSL30 if (method == QCryptographicHash::Blake2b_160 || method == QCryptographicHash::Blake2b_256 || @@ -569,7 +570,6 @@ void QCryptographicHashPrivate::reset() noexcept #endif } #endif // !QT_CONFIG(opensslv30) - result.clear(); } #if QT_DEPRECATED_SINCE(6, 4)