Commit 520e980c authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf
Browse files

libndi: Add TODO for bounds checking

parent b2297ff1
......@@ -242,12 +242,12 @@ static int process_audio_message(ndi_ctx *ndi_ctx, uint8_t *data, int header_len
uint32_t num_channels = (data[11] << 24) | (data[10] << 16) | (data[9] << 8) | data[8];
uint32_t sample_rate = (data[15] << 24) | (data[14] << 16) | (data[13] << 8) | data[12];
float scale_factors[16];
uint32_t num_nonzero_channels = 0;
// XXX: some more things in the header
data += header_len;
if(fourcc == MKTAG('f','o','w','t')) {
uint32_t num_nonzero_channels = 0;
for(uint32_t i = 0; i < num_channels; i++) {
uint32_t tmp = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
memcpy(&scale_factors[i], &tmp, sizeof(float));
......@@ -261,8 +261,11 @@ static int process_audio_message(ndi_ctx *ndi_ctx, uint8_t *data, int header_len
for(uint32_t i = 0; i < num_channels; i++) {
scale_factors[i] = 1.0f;
}
num_nonzero_channels = num_channels;
}
// XXX: Bounds check audio samples
ndi_data.data_type = NDI_DATA_AUDIO;
ndi_data.fourcc = fourcc;
ndi_data.samples = samples;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment