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]>
  • Loading branch information
softwarecki committed Sep 18, 2023
1 parent 840ee46 commit 32c1256
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 32c1256

Please sign in to comment.