do not use VLA for packet buffers

Clang 18 complains on that in C++ code and it is unneeded since we are
limitted by the maximal (RTP) packet MTU.
This commit is contained in:
Martin Pulec
2024-03-25 14:23:55 +01:00
parent 21f4627af5
commit cbefa757a7
3 changed files with 4 additions and 4 deletions

View File

@@ -683,7 +683,7 @@ int decode_audio_frame(struct coded_data *cdata, void *pbuf_data, struct pbuf_st
}
unsigned int length;
char plaintext[cdata->data->data_len]; // plaintext will be actually shorter
char plaintext[RTP_MAX_PACKET_LEN]; // plaintext will be actually shorter
size_t main_hdr_len = PT_AUDIO_HAS_FEC(pt) ? sizeof(fec_payload_hdr_t) : sizeof(audio_payload_hdr_t);
if (PT_AUDIO_IS_ENCRYPTED(pt)) {
uint32_t encryption_hdr = ntohl(*(uint32_t *)(void *) (cdata->data->data + main_hdr_len));

View File

@@ -1608,7 +1608,7 @@ int decode_video_frame(struct coded_data *cdata, void *decoder_data, struct pbuf
goto cleanup;
}
char plaintext[len]; // will be actually shorter
char plaintext[RTP_MAX_PACKET_LEN]; // will be actually shorter
if (PT_VIDEO_IS_ENCRYPTED(pt)) {
int data_len;

View File

@@ -716,7 +716,7 @@ tx_send_base(struct tx *tx, struct video_frame *frame, struct rtp *rtp_session,
char *data = tile->data + ntohl(rtp_hdr_packet[1]);
int data_len = packet_sizes.at(i % packet_sizes.size());
char encrypted_data[data_len + MAX_CRYPTO_EXCEED];
char encrypted_data[RTP_MAX_PACKET_LEN + MAX_CRYPTO_EXCEED];
if (tx->encryption != nullptr) {
data_len = tx->enc_funcs->encrypt(
tx->encryption, data, data_len,
@@ -851,7 +851,7 @@ audio_tx_send_chan(struct tx *tx, struct rtp *rtp_session, uint32_t timestamp,
rtp_hdr[1] = htonl(pos);
pos += data_len;
char encrypted_data[data_len + MAX_CRYPTO_EXCEED];
char encrypted_data[RTP_MAX_PACKET_LEN + MAX_CRYPTO_EXCEED];
if (tx->encryption) {
data_len = tx->enc_funcs->encrypt(
tx->encryption, const_cast<char *>(data), data_len,