Skip to content

nimble/audio: Bound broadcast sink subgroup count#2251

Open
Old-Ding wants to merge 1 commit into
apache:masterfrom
Old-Ding:fix/broadcast-sink-subgroups-bound
Open

nimble/audio: Bound broadcast sink subgroup count#2251
Old-Ding wants to merge 1 commit into
apache:masterfrom
Old-Ding:fix/broadcast-sink-subgroups-bound

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 1, 2026

Copy link
Copy Markdown

Summary

  • reject broadcast sink sync options whose subgroup count exceeds capacity
  • add a broadcast sink unit test for oversized subgroup counts
  • enable broadcast sink coverage in the audio unit test syscfg

Root cause

ble_audio_broadcast_sink_config() copied sync_opt->num_subgroups
into sink->num_subgroups and then used it as the loop bound for the
fixed sink->subgroups[] array. The visible guard was only a debug
assertion in the scan delegator path, so production builds could still
receive an oversized sync option.

Validation

  • git diff --check
  • newt test @apache-mynewt-nimble/nimble/host/audio/test stops on
    Windows before executing tests because the native Newt target includes
    POSIX sys/mman.h; the PR CI runs this path on Ubuntu.

Fixes #2188.

@github-actions github-actions Bot added host size/S Small PR labels Jul 1, 2026
@Old-Ding Old-Ding force-pushed the fix/broadcast-sink-subgroups-bound branch from e23bad0 to 577a451 Compare July 1, 2026 02:23
@Old-Ding Old-Ding changed the title [codex] nimble/audio: Bound broadcast sink subgroup count nimble/audio: Bound broadcast sink subgroup count Jul 1, 2026
@Old-Ding Old-Ding marked this pull request as ready for review July 1, 2026 02:49
@sjanc

sjanc commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Hi,

I have mixed feelings on this PR, while fix itself seems to be OK from quick look, unittest is not building, and if it would build it would fail (due to #2254).

So, was this tested at all?

Reject sync requests whose subgroup count exceeds the broadcast
sink subgroup array before copying BIS sync values into it.

The previous code relied on a debug assertion in the scan
delegator path, but production builds can still receive an
oversized sync option.

Fixes apache#2188

Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
@Old-Ding Old-Ding force-pushed the fix/broadcast-sink-subgroups-bound branch from 577a451 to a1471dd Compare July 8, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] ble_audio_broadcast_sink configuration does not bound num_subgroups before writing sink->subgroups

3 participants