Skip to content

Commit

Permalink
module_adapter: ModuleInitialSettingsConcrete: Fix possible null refe…
Browse files Browse the repository at this point in the history
…rence

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 <[email protected]>
Signed-off-by: Kai Vehmanen <[email protected]>
(cherry picked from commit c9e0fc8)
  • Loading branch information
softwarecki authored and kv2019i committed Sep 19, 2023
1 parent 2d834e9 commit 9c4c2cc
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9c4c2cc

Please sign in to comment.