mirror of
https://github.com/rehlds/revoice.git
synced 2025-03-03 09:05:29 +03:00
fixed vulnerable client-side attack via invalid voice packet
This commit is contained in:
parent
15780dfcaf
commit
5f71fde202
@ -197,6 +197,12 @@ int VoiceEncoder_Opus::Decompress(const char *pCompressed, int compressedBytes,
|
||||
break;
|
||||
|
||||
int nBytes = opus_decode(m_pDecoder, 0, 0, (opus_int16 *)pWritePos, FRAME_SIZE, 0);
|
||||
if (nBytes <= 0)
|
||||
{
|
||||
// raw corrupted
|
||||
return 0;
|
||||
}
|
||||
|
||||
pWritePos += nBytes * 2;
|
||||
}
|
||||
}
|
||||
@ -223,6 +229,11 @@ int VoiceEncoder_Opus::Decompress(const char *pCompressed, int compressedBytes,
|
||||
}
|
||||
|
||||
int nBytes = opus_decode(m_pDecoder, (const unsigned char *)pReadPos, nPayloadSize, (opus_int16 *)pWritePos, FRAME_SIZE, 0);
|
||||
if (nBytes <= 0)
|
||||
{
|
||||
// raw corrupted
|
||||
return 0;
|
||||
}
|
||||
|
||||
pReadPos += nPayloadSize;
|
||||
pWritePos += nBytes * 2;
|
||||
|
@ -105,7 +105,12 @@ void SV_ParseVoiceData_emu(IGameClient *cl)
|
||||
|
||||
silkData = chReceived; silkDataLen = nDataLength;
|
||||
speexData = transcodedBuf;
|
||||
speexDataLen = TranscodeVoice(srcPlayer, silkData, silkDataLen, srcPlayer->GetOpusCodec(), srcPlayer->GetSpeexCodec(), transcodedBuf, sizeof(transcodedBuf));
|
||||
|
||||
int numDecodedSamples = TranscodeVoice(srcPlayer, silkData, silkDataLen, srcPlayer->GetOpusCodec(), srcPlayer->GetSpeexCodec(), transcodedBuf, sizeof(transcodedBuf));
|
||||
if (numDecodedSamples <= 0)
|
||||
return;
|
||||
|
||||
speexDataLen = numDecodedSamples;
|
||||
break;
|
||||
}
|
||||
case vct_speex:
|
||||
|
Loading…
x
Reference in New Issue
Block a user