mirror of https://github.com/thesofproject/sof.git
Audio: SRC: Add safeguard against missing, wrong size or type init data
In some error situations the configuration init_data may be NULL, and in such a situations we should fail gracefully and not crash. Also adds check that the IPC message is of correct size and of correct type. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
This commit is contained in:
parent
619477a186
commit
4849a71ada
|
@ -921,6 +921,12 @@ static int src_init(struct processing_module *mod)
|
|||
|
||||
comp_dbg(dev, "src_init()");
|
||||
|
||||
if (dev->ipc_config.type != SOF_COMP_SRC || !cfg->init_data ||
|
||||
cfg->size != sizeof(cd->ipc_config)) {
|
||||
comp_err(dev, "src_init(): Missing or bad size (%u) init data",
|
||||
cfg->size);
|
||||
return -EINVAL;
|
||||
}
|
||||
/* validate init data - either SRC sink or source rate must be set */
|
||||
if (src_rate_check(cfg->init_data) < 0) {
|
||||
comp_err(dev, "src_init(): SRC sink and source rate are not set");
|
||||
|
|
Loading…
Reference in New Issue