Skip to content

Commit bfe1dba

Browse files
committed
audio: aria: reject zero sample group size in init
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>
1 parent 9cd055b commit bfe1dba

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/audio/aria/aria.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ static int aria_init(struct processing_module *mod)
123123
list_init(&dev->bsource_list);
124124
list_init(&dev->bsink_list);
125125

126+
/* sample group size is used as a divisor below, reject configs that make it zero */
127+
if (!base_cfg->audio_fmt.channels_count || base_cfg->audio_fmt.depth < 8) {
128+
comp_err(dev, "invalid channels:%u depth:%u",
129+
base_cfg->audio_fmt.channels_count, base_cfg->audio_fmt.depth);
130+
return -EINVAL;
131+
}
132+
126133
cd = mod_zalloc(mod, sizeof(*cd));
127134
if (!cd) {
128135
return -ENOMEM;

0 commit comments

Comments
 (0)