From 0f2c1f74c847d54f86775cf49e1eab3fbcb3a628 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 10 Mar 2016 09:52:05 +0000 Subject: [PATCH] Added a check in WindowsMediaAudioFormat to handle reading beyond the end of a file --- .../codecs/juce_WindowsMediaAudioFormat.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp index 746ce640ba..cc22f41a03 100644 --- a/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp @@ -166,6 +166,9 @@ public: checkCoInitialiseCalled(); + clearSamplesBeyondAvailableLength (destSamples, numDestChannels, startOffsetInDestBuffer, + startSampleInFile, numSamples, lengthInSamples); + const int stride = numChannels * sizeof (int16); while (numSamples > 0) @@ -297,7 +300,7 @@ private: sampleRate = inputFormat->nSamplesPerSec; numChannels = inputFormat->nChannels; - bitsPerSample = inputFormat->wBitsPerSample; + bitsPerSample = inputFormat->wBitsPerSample != 0 ? inputFormat->wBitsPerSample : 16; lengthInSamples = (lengthInNanoseconds * (int) sampleRate) / 10000000; } }