treewide: access the position information using helpers

Make sure we don't access out of bounds and that we use the helpers
wherever we can to access the position information.
This commit is contained in:
Wim Taymans 2025-10-21 13:06:25 +02:00
parent 8bbca3b8f3
commit 818d1435ce
25 changed files with 155 additions and 114 deletions

View file

@ -538,8 +538,7 @@ static void param_format_changed(struct impl *impl, const struct spa_pod *param,
spa_zero(info);
if (param != NULL) {
if (spa_format_audio_raw_parse(param, &info) < 0 ||
info.channels == 0 ||
info.channels > SPA_N_ELEMENTS(info.position))
info.channels == 0)
return;
if ((impl->info.format != 0 && impl->info.format != info.format) ||
@ -547,7 +546,7 @@ static void param_format_changed(struct impl *impl, const struct spa_pod *param,
(impl->info.channels != 0 &&
(impl->info.channels != info.channels ||
memcmp(impl->info.position, info.position,
info.channels * sizeof(uint32_t)) != 0))) {
SPA_MIN(info.channels, SPA_AUDIO_MAX_CHANNELS) * sizeof(uint32_t)) != 0))) {
uint8_t buffer[1024];
struct spa_pod_builder b;
const struct spa_pod *params[1];