Uninitialized variable in Voice::update_param()

• Jun 2, 2018 - 23:33
Type
Functional
Severity
S4 - Minor
Status
active
Project

Runninng the latest master branch of MuseScore through Valgrind, results in the following report (among a couple of others, which seem to be problems in Qt or Freetype code):

==19539== Thread 6:
==19539== Conditional jump or move depends on uninitialised value(s)
==19539==    at 0x9D8738: FluidS::Voice::update_param(int) (voice.cpp:1087)
==19539==    by 0x9D9793: FluidS::Voice::voice_start() (voice.cpp:811)
==19539==    by 0x9D3587: FluidS::Fluid::start_voice(FluidS::Voice*) (fluid.cpp:557)
==19539==    by 0x9DC103: FluidS::Preset::noteon(FluidS::Fluid*, unsigned int, int, int, int, double) (sfont.cpp:330)
==19539==    by 0x9D55A2: FluidS::Fluid::play(Ms::PlayEvent const&) (fluid.cpp:175)
==19539==    by 0x6E2466: Ms::Seq::putEvent(Ms::NPlayEvent const&, unsigned int) (seq.cpp:1425)
==19539==    by 0x6E46D6: Ms::Seq::process(unsigned int, float*) (seq.cpp:847)
==19539==    by 0x9639A1: Ms::AlsaAudio::alsaLoop() (alsa.cpp:681)
==19539==    by 0x963A38: Ms::alsaLoop(void*) (alsa.cpp:652)
==19539==    by 0x7610493: start_thread (pthread_create.c:333)
==19539==    by 0xB622AFE: clone (clone.S:97)

The code handling case GEN_MODLFOFREQ, seems to use the variable modlfo_dur, wihtout having initialized it first. Adding a line initializing it to zero inside the constructor makes the report go away, but I haven't looked into the code enough to know whether that's the correct fix.