ucm: macro - add deep call protection (recursion)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2022-05-17 19:25:20 +02:00
parent 80ac6f9866
commit 55340cf96a
2 changed files with 7 additions and 0 deletions

View file

@ -575,7 +575,13 @@ int uc_mgr_evaluate_inplace(snd_use_case_mgr_t *uc_mgr,
/* conditions may depend on them */
if (err2 == 0)
continue;
uc_mgr->macro_hops++;
if (uc_mgr->macro_hops > 100) {
uc_error("Maximal macro hops reached!");
return -EINVAL;
}
err3 = evaluate_macro(uc_mgr, cfg);
uc_mgr->macro_hops--;
if (err3 < 0)
return err3;
if (err3 == 0)