mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 17:44:18 +00:00
Fuzzing options
This commit is contained in:
parent
8275f2d811
commit
366f0281ed
|
@ -121,12 +121,14 @@ void CNetBase::SendPacket(NETSOCKET Socket, NETADDR *pAddr, CNetPacketConstruct
|
||||||
CompressedSize = ms_Huffman.Compress(pPacket->m_aChunkData, pPacket->m_DataSize, &aBuffer[3], NET_MAX_PACKETSIZE-4);
|
CompressedSize = ms_Huffman.Compress(pPacket->m_aChunkData, pPacket->m_DataSize, &aBuffer[3], NET_MAX_PACKETSIZE-4);
|
||||||
|
|
||||||
// check if the compression was enabled, successful and good enough
|
// check if the compression was enabled, successful and good enough
|
||||||
|
#ifndef FUZZING
|
||||||
if(CompressedSize > 0 && CompressedSize < pPacket->m_DataSize)
|
if(CompressedSize > 0 && CompressedSize < pPacket->m_DataSize)
|
||||||
{
|
{
|
||||||
FinalSize = CompressedSize;
|
FinalSize = CompressedSize;
|
||||||
pPacket->m_Flags |= NET_PACKETFLAG_COMPRESSION;
|
pPacket->m_Flags |= NET_PACKETFLAG_COMPRESSION;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// use uncompressed data
|
// use uncompressed data
|
||||||
FinalSize = pPacket->m_DataSize;
|
FinalSize = pPacket->m_DataSize;
|
||||||
|
|
|
@ -249,8 +249,10 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
|
||||||
mem_copy(&nAddr, pAddr, sizeof(nAddr));
|
mem_copy(&nAddr, pAddr, sizeof(nAddr));
|
||||||
nAddr.port = 0;
|
nAddr.port = 0;
|
||||||
m_PeerAddr.port = 0;
|
m_PeerAddr.port = 0;
|
||||||
|
#ifndef FUZZING
|
||||||
if(net_addr_comp(&m_PeerAddr, &nAddr) == 0 && time_get() - m_LastUpdateTime < time_freq() * 3)
|
if(net_addr_comp(&m_PeerAddr, &nAddr) == 0 && time_get() - m_LastUpdateTime < time_freq() * 3)
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// send response and init connection
|
// send response and init connection
|
||||||
Reset();
|
Reset();
|
||||||
|
|
Loading…
Reference in a new issue