From 75effb4f356a12304ca56707e54eef3328d5f807 Mon Sep 17 00:00:00 2001 From: sproxet Date: Sun, 31 Jul 2022 16:41:03 +0700 Subject: [PATCH] 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()) {