possible access violation in ResamplingAudioSource::resetFilters


#1

Hello,

In the resetFilters() function there is no check to make sure that filterStates.getData() != nullptr before attempting to do the clear. Obviously, this results in an access violation if data does not exist.

I ran into this by calling setPosition on an AudioTransportSource (with a 48khz source feeding a 44.1khz output device) before adding the transport source to the rest of my pipeline and calling start(). If I don't set sourceSampleRateToCorrectFor, the internal resampler never gets created and the access violation doesn't happen. Also, if I add the transport source to my pipeline and then call setPosition(), everything is fine.

It seems the correct thing to do is to make sure the pipeline is completely constructed before trying to call setPosition, however, this kind of thing isn't written anywhere so new people like me are liable to run into this issue.

Anyway, I apologize if it's all in the documentation/forums and I just couldn't find it. It would be nice if there were a JUCE Cookbook/wiki. 


#2

Thanks, I'll add that null check!