Skip to content

Commit df32cb3

Browse files
committed
audio: selector: check source and sink buffers before prepare
The IPC4 fuzzer hit a NULL pointer dereference in selector_prepare(). ASan reports a READ SEGV at address 0x10 in audio_buffer_hw_params_configured() reached from set_selector_params(), UBSan reports "member access within null pointer of type 'struct comp_buffer'" at selector.c set_selector_params(). The host can instantiate a selector (MICSEL) in a pipeline and send SET_PIPELINE_STATE before binding any buffers to it. Prepare then runs with empty source and sink lists, and set_selector_params() takes comp_dev_get_first_data_producer() == NULL and dereferences src_buf->audio_buffer.audio_stream_params (offset 0x10). The rest of selector_verify_params() and selector_prepare() also use the first producer/consumer without checking them. look the sink/source count at the start of selector_prepare() and fail with -ENOTCONN if either is missing, as rtnr does. Valid topologies always bind the selector before prepare, so this does not reject legitimate configurations. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
1 parent 2d2476f commit df32cb3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/audio/selector/selector.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,11 @@ static int selector_prepare(struct processing_module *mod,
10891089

10901090
comp_dbg(dev, "entry");
10911091

1092+
if (!num_of_sources || !num_of_sinks) {
1093+
comp_err(dev, "no source or sink buffer");
1094+
return -ENOTCONN;
1095+
}
1096+
10921097
ret = selector_params(mod);
10931098
if (ret < 0)
10941099
return ret;

0 commit comments

Comments
 (0)