Bluetooth: BAP: Broadcast source: Add LTV validation for LC3 data
When using the LC3 codec, all codec configuration are LTV encoded. The broadcast source did not properly validate this, and it also uncovered a bug in the bsim test for broadcast sources. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
e08301b3df
commit
8a6c1d9bfa
5 changed files with 36 additions and 3 deletions
|
@ -578,6 +578,7 @@ static bool valid_broadcast_source_param(const struct bt_bap_broadcast_source_pa
|
|||
return false;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE > 0
|
||||
CHECKIF(stream_param->data == NULL && stream_param->data_len != 0) {
|
||||
LOG_DBG("subgroup_params[%zu].stream_params[%zu]->data is "
|
||||
"NULL with len %zu",
|
||||
|
@ -585,7 +586,6 @@ static bool valid_broadcast_source_param(const struct bt_bap_broadcast_source_pa
|
|||
return false;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE > 0
|
||||
CHECKIF(stream_param->data_len > CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE) {
|
||||
LOG_DBG("subgroup_params[%zu].stream_params[%zu]->data_len too "
|
||||
"large: %zu > %d",
|
||||
|
@ -593,6 +593,14 @@ static bool valid_broadcast_source_param(const struct bt_bap_broadcast_source_pa
|
|||
CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE);
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECKIF(subgroup_param->codec_cfg->id == BT_HCI_CODING_FORMAT_LC3 &&
|
||||
!bt_audio_valid_ltv(stream_param->data, stream_param->data_len)) {
|
||||
LOG_DBG("subgroup_params[%zu].stream_params[%zu]->data not valid "
|
||||
"LTV",
|
||||
i, j);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE > 0 */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue