Skip to content

Memory reference error and Integer Overflow #39

Open
@gems2020

Description

@gems2020
  1. Memory reference error - NatPunchthroughServer
    This error occurs when disconnecting while attempting a hole punch inside the local PC.
    It refers to the unallocated 'otherUser'
    The solution was as follows.

NatPunchthroughServer.cpp

		if (connectionAttempt->attemptPhase==ConnectionAttempt::NAT_ATTEMPT_PHASE_GETTING_RECENT_PORTS)
		{
			otherUser->isReady=true;
			
			if (connectionAttempt->sender != user || connectionAttempt->recipient != user) 
			{
					freedUpInProgressUsers.Insert(otherUser, _FILE_AND_LINE_); 
			}
		}

2.Integer Overflow
This error occurs when approximately 2 GB of large data is transferred continuously.

I replaced it with 64-bit type as follows.

CCRakNetSlidingWindow.h

int64_t GetRetransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint64_t unacknowledgedBytes, bool isContinuousSend); 
int64_t GetTransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint64_t unacknowledgedBytes, bool isContinuousSend); 

CCRakNetSlidingWindow.cpp

		int64_t CCRakNetSlidingWindow::GetRetransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint64_t unacknowledgedBytes, bool isContinuousSend)
		{
			(void) curTime;
			(void) isContinuousSend;
			(void) timeSinceLastTick;

			return unacknowledgedBytes;
		}


		int64_t CCRakNetSlidingWindow::GetTransmissionBandwidth(CCTimeType curTime, CCTimeType timeSinceLastTick, uint64_t unacknowledgedBytes, bool isContinuousSend)
		{
			(void) curTime;
			(void) timeSinceLastTick;

			_isContinuousSend=isContinuousSend;

			if (unacknowledgedBytes<=cwnd)
				return (int64_t) (cwnd-unacknowledgedBytes);
			else
				return 0;
		}

ReliabilityLayer.h

580 line

uint64_t unacknowledgedBytes;

ReliabilityLayer.cpp

1959 line

	int64_t transmissionBandwidth = congestionManager.GetTransmissionBandwidth(time, timeSinceLastTick, unacknowledgedBytes,dhf.isContinuousSend); 
	int64_t retransmissionBandwidth = congestionManager.GetRetransmissionBandwidth(time, timeSinceLastTick, unacknowledgedBytes,dhf.isContinuousSend);  

This is a temporary solution and not a fundamental solution. I wish someone could fix it better.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions