From 18922a1b3272e93c8539fe110c99206af2baa041 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 12 Nov 2026 22:29:27 -0600 Subject: [PATCH] Reject audio packets with no payload It causes our Opus header validation to access uninitialized memory. --- src/AudioStream.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/AudioStream.c b/src/AudioStream.c index 698ee9f..4310716 100644 --- a/src/AudioStream.c +++ b/src/AudioStream.c @@ -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];