module_adapter: ModuleInitialSettingsConcrete: Fix possible null reference

The dataAs function can return null if the buffer size is smaller than the
size of the target structure. Added handler for this situation.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This commit is contained in:
Adrian Warecki 2023-09-04 15:37:29 +02:00 committed by Kai Vehmanen
parent 6f2475b086
commit c9e0fc8c9a
1 changed files with 3 additions and 0 deletions

View File

@ -49,6 +49,9 @@ ModuleInitialSettingsConcrete::ModuleInitialSettingsConcrete(DwordArray const &c
/* It shall contain BaseModuleCfg + BaseModuleCfgExt + */
/* optionally some InputPinFormat[] + OutputPinFormat[] data */
CompoundCfg const * unvalidated_compound_cfg = cfg_ipc_msg.dataAs<CompoundCfg>();
if (!unvalidated_compound_cfg)
return;
const size_t computed_msg_size =
sizeof(CompoundCfg) -
/* CompoundCfg already contains one InputPinFormat and