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];