From 8affeb074f501044338561027247049c9962968c Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 28 Jul 2026 10:29:22 -0400 Subject: [PATCH] fixed possible m_PacketACKIntervalRem overflow --- libi2pd/Streaming.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libi2pd/Streaming.cpp b/libi2pd/Streaming.cpp index b20b13d7..8e927a80 100644 --- a/libi2pd/Streaming.cpp +++ b/libi2pd/Streaming.cpp @@ -1173,7 +1173,11 @@ namespace stream if (m_LastACKSendTime) passedTime = (ts - m_LastACKSendTime)*1000; // in microseconds numPackets = (passedTime + m_PacketACKIntervalRem) / m_PacketACKInterval; - m_PacketACKIntervalRem = (passedTime + m_PacketACKIntervalRem) - (numPackets * m_PacketACKInterval); + int64_t delta = numPackets * m_PacketACKInterval - passedTime; + if (delta < (int64_t)m_PacketACKIntervalRem) + m_PacketACKIntervalRem -= delta; + else + m_PacketACKIntervalRem = 0; if (m_LastConfirmedReceivedSequenceNumber + numPackets < m_LastReceivedSequenceNumber) { lastReceivedSeqn = m_LastConfirmedReceivedSequenceNumber + numPackets;