From 7ca6bcc16addd2104821074aac463ad1499b63ae Mon Sep 17 00:00:00 2001 From: jjceresa Date: Sun, 15 Sep 2019 03:46:31 +0200 Subject: [PATCH] Enforce fluid_voice_add_mod() checking --- src/synth/fluid_voice.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/synth/fluid_voice.c b/src/synth/fluid_voice.c index df40df5d..98bea86f 100644 --- a/src/synth/fluid_voice.c +++ b/src/synth/fluid_voice.c @@ -1539,9 +1539,17 @@ fluid_voice_stop(fluid_voice_t *voice) void fluid_voice_add_mod(fluid_voice_t *voice, fluid_mod_t *mod, int mode) { + fluid_return_if_fail(voice != NULL); + fluid_return_if_fail(mod != NULL); + + /* mod must be simple modulator. Ignore it if it is a linked modulator */ + fluid_return_if_fail(!fluid_mod_is_linked(mod)); + /* Ignore the modulator if its sources inputs are invalid */ if(fluid_mod_check_sources(mod, "api fluid_voice_add_mod mod")) { + /* Initialize next, in case mod doesn't come from new_fluid_mod() */ + mod->next = NULL; fluid_voice_add_mod_local(voice, mod, mode, FLUID_NUM_MOD); } }