Skip to content

audio: aria: reject zero sample group size in init#10891

Open
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/audio/aria/fix/divide-by-zero
Open

audio: aria: reject zero sample group size in init#10891
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/audio/aria/fix/divide-by-zero

Conversation

@tmleman

@tmleman tmleman commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

aria_init() computes sgs = (depth >> 3) * channels_count and then divides ibs by sgs. A host-supplied base config with channels_count of 0 or depth below 8 makes sgs zero, causing a divide-by-zero.

Validate channels_count and depth before the division.

Copilot AI review requested due to automatic review settings June 12, 2026 07:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens aria_init() against host-provided IPC4 base configs that can cause a divide-by-zero when computing the sample group count.

Changes:

  • Add validation for channels_count == 0 and depth < 8 before computing sgs and dividing ibs / sgs.

Comment thread src/audio/aria/aria.c
Comment on lines +126 to +132
/* sample group size is used as a divisor below, reject configs that make it zero */
if (!base_cfg->audio_fmt.channels_count || base_cfg->audio_fmt.depth < 8) {
comp_err(dev, "invalid channels:%u depth:%u",
base_cfg->audio_fmt.channels_count, base_cfg->audio_fmt.depth);
return -EINVAL;
}

aria_init() computes sgs = (depth >> 3) * channels_count and then
divides ibs by sgs. A host-supplied base config with channels_count
of 0 or depth below 8 makes sgs zero, causing a divide-by-zero.

Validate channels_count and depth before the division.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants