From 9c4c2cc95626eb5f010ead06309a256486d3d98c Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Mon, 4 Sep 2023 15:37:29 +0200 Subject: [PATCH] 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 Signed-off-by: Kai Vehmanen (cherry picked from commit c9e0fc8c9afdc3d5e87cf3d6cc908603cf5c8b59) --- .../module_adapter/iadk/module_initial_settings_concrete.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/audio/module_adapter/iadk/module_initial_settings_concrete.cpp b/src/audio/module_adapter/iadk/module_initial_settings_concrete.cpp index 2460aaee51b3..bf8909d8b543 100644 --- a/src/audio/module_adapter/iadk/module_initial_settings_concrete.cpp +++ b/src/audio/module_adapter/iadk/module_initial_settings_concrete.cpp @@ -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(); + if (!unvalidated_compound_cfg) + return; + const size_t computed_msg_size = sizeof(CompoundCfg) - /* CompoundCfg already contains one InputPinFormat and