NaN output from low-pass filter on low sample rate devices

I have been working on a bug on Switch whereby audio would cut out using the new audio mixer on UE4.25. I tracked it down to NaNs getting into the audio stream from a low-pass filter. The filter itself was a one-pole, but I think the problem applies to most if not all other filters.

From what I can tell, the issue is that filters have their cutoff frequency limited between 80-18000 Hz, presumably due to human hearing ranges, but on Switch where the render sample rate is 32000 by default, 18000 is above the Nyquist limit. This results in the A0 coefficient going above zero, leading to the signal blowing out to inf and then NaN.

I have fixed this by additionally limiting the max cutoff frequency to 0.45 * SampleRate inside IFilter::Update(), but as I am not an audio engineer by trade this may not be the correct fix, and/or I may have misunderstood the problem.

I’m posting this here in case it is of benefit to anyone else, and possibly to get thoughts from someone at Epic as to whether I’ve understood/fixed the problem correctly.