From a8dcd7ffc27bfcc96087e5dde37ce986f816da00 Mon Sep 17 00:00:00 2001 From: sproxet Date: Sun, 31 Jul 2022 16:11:52 +0700 Subject: [PATCH 1/3] Fix UB in bls. --- src/bls/bls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bls/bls.h b/src/bls/bls.h index f4ccb17f5c..6330d0f95c 100644 --- a/src/bls/bls.h +++ b/src/bls/bls.h @@ -42,7 +42,7 @@ class CBLSWrapper friend class CBLSPublicKey; friend class CBLSSignature; - bool fLegacy; + bool fLegacy{fLegacyDefault}; protected: ImplType impl; From 75effb4f356a12304ca56707e54eef3328d5f807 Mon Sep 17 00:00:00 2001 From: sproxet Date: Sun, 31 Jul 2022 16:41:03 +0700 Subject: [PATCH 2/3] Fix UB in CDKGSessionHandler::SleepBeforePhase. --- src/llmq/quorums_dkgsessionhandler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/llmq/quorums_dkgsessionhandler.cpp b/src/llmq/quorums_dkgsessionhandler.cpp index e472ac5de0..fe3bde4746 100644 --- a/src/llmq/quorums_dkgsessionhandler.cpp +++ b/src/llmq/quorums_dkgsessionhandler.cpp @@ -238,7 +238,8 @@ void CDKGSessionHandler::SleepBeforePhase(QuorumPhase curPhase, phaseTime = 0; } - int64_t sleepTime = (int64_t)(phaseTime * curSession->GetMyMemberIndex()); + int64_t sleepTime = 0; + if (curSession->GetMyMemberIndex() != UINT64_MAX) sleepTime = (int64_t)(phaseTime * curSession->GetMyMemberIndex()); int64_t endTime = GetTimeMillis() + sleepTime; while (GetTimeMillis() < endTime) { if (stopRequested || ShutdownRequested()) { From 40ce1d20232d8928486e7b3a963f18d722952b1f Mon Sep 17 00:00:00 2001 From: sproxet Date: Sat, 30 Jul 2022 17:40:00 +0700 Subject: [PATCH 3/3] Fix UB in CQuorumBlockProcessor::GetCommitmentsFromBlock. --- src/llmq/quorums_blockprocessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/llmq/quorums_blockprocessor.cpp b/src/llmq/quorums_blockprocessor.cpp index c24170c283..796fff6fb2 100644 --- a/src/llmq/quorums_blockprocessor.cpp +++ b/src/llmq/quorums_blockprocessor.cpp @@ -321,7 +321,8 @@ bool CQuorumBlockProcessor::GetCommitmentsFromBlock(const CBlock& block, const C return state.DoS(100, false, REJECT_INVALID, "bad-qc-dup"); } - ret.emplace((Consensus::LLMQType)qc.commitment.llmqType, std::move(qc.commitment)); + auto llmqTypeTemp = (Consensus::LLMQType)qc.commitment.llmqType; + ret.emplace(llmqTypeTemp, std::move(qc.commitment)); } }