From 3514a87b371385cdc71a2ed36deb40cd0275fff5 Mon Sep 17 00:00:00 2001 From: reduz Date: Thu, 8 Oct 2015 14:50:18 -0300 Subject: [PATCH] fixed uninitialized memory issues in audio code --- drivers/speex/audio_stream_speex.cpp | 4 +++- drivers/speex/audio_stream_speex.h | 1 - servers/audio/audio_mixer_sw.cpp | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/speex/audio_stream_speex.cpp b/drivers/speex/audio_stream_speex.cpp index 2440969345e..1bb4952cc8b 100644 --- a/drivers/speex/audio_stream_speex.cpp +++ b/drivers/speex/audio_stream_speex.cpp @@ -22,7 +22,7 @@ int AudioStreamPlaybackSpeex::mix(int16_t* p_buffer,int p_frames) { //printf("update, loops %i, read ofs %i\n", (int)loops, read_ofs); //printf("playing %i, paused %i\n", (int)playing, (int)paused); - if (!active || !playing || paused || !data.size()) + if (!active || !playing || !data.size()) return 0; /* @@ -490,6 +490,8 @@ AudioStreamPlaybackSpeex::AudioStreamPlaybackSpeex() { stream_channels=1; stream_srate=1; stream_minbuff_size=1; + playing=false; + } diff --git a/drivers/speex/audio_stream_speex.h b/drivers/speex/audio_stream_speex.h index 570e8467348..f0617b302fe 100644 --- a/drivers/speex/audio_stream_speex.h +++ b/drivers/speex/audio_stream_speex.h @@ -29,7 +29,6 @@ class AudioStreamPlaybackSpeex : public AudioStreamPlayback { bool loops; int page_size; bool playing; - bool paused; bool packets_available; void unload(); diff --git a/servers/audio/audio_mixer_sw.cpp b/servers/audio/audio_mixer_sw.cpp index 788eec0d4aa..791f31719ed 100644 --- a/servers/audio/audio_mixer_sw.cpp +++ b/servers/audio/audio_mixer_sw.cpp @@ -765,6 +765,10 @@ AudioMixer::ChannelID AudioMixerSW::channel_alloc(RID p_sample) { c.mix.increment=1; //zero everything when this errors for(int i=0;i<4;i++) { + c.mix.vol[i]=0; + c.mix.reverb_vol[i]=0; + c.mix.chorus_vol[i]=0; + c.mix.old_vol[i]=0; c.mix.old_reverb_vol[i]=0; c.mix.old_chorus_vol[i]=0;