Reject audio packets with no payload

It causes our Opus header validation to access uninitialized memory.
This commit is contained in:
Cameron Gutman committed 2026-11-12 22:29:27 -06:00
1 parent 2b45ee9f64
commit 18922a1b32
1 file changed
+11 -1
+11 -1
View File
@@ -175,11 +175,11 @@ static void decodeInputData(PQUEUED_AUDIO_PACKET packet) {
lastSeq = rtp->sequenceNumber;
int dataLength = packet->header.size - sizeof(*rtp);
if (AudioEncryptionEnabled) {
// We must have room for the AES padding which may be written to the buffer
unsigned char decryptedOpusData[ROUND_TO_PKCS7_PADDED_LEN(MAX_PACKET_SIZE)];
unsigned char iv[16] = { 0 };
int dataLength = packet->header.size - sizeof(*rtp);
LC_ASSERT(dataLength <= MAX_PACKET_SIZE);
@@ -200,6 +200,11 @@ static void decodeInputData(PQUEUED_AUDIO_PACKET packet) {
return;
}
if (dataLength == 0) {
LC_ASSERT_VT(false);
return;
}
#ifdef LC_DEBUG
if (opusHeaderByte == INVALID_OPUS_HEADER) {
opusHeaderByte = decryptedOpusData[0];
@@ -218,6 +223,11 @@ static void decodeInputData(PQUEUED_AUDIO_PACKET packet) {
AudioCallbacks.decodeAndPlaySample((char*)decryptedOpusData, dataLength);
}
else {
if (dataLength == 0) {
LC_ASSERT_VT(false);
return;
}
#ifdef LC_DEBUG
if (opusHeaderByte == INVALID_OPUS_HEADER) {
opusHeaderByte = ((uint8_t*)(rtp + 1))[0];