Skip to content

No NaN/Inf sanitization on audio output #17

@user1303836

Description

@user1303836

Problem

There is zero NaN/Inf checking anywhere in the signal chain (source/PluginProcessor.cpp:91-169). If any component produces NaN (pitch detector division by zero, smoother with bad alpha, oscillator with bad increment, or even NaN passed in from a prior plugin in the chain), it propagates directly to the DAW's audio output buffer.

NaN in audio output can cause:

  • Silence in some DAWs
  • Loud noise/pops in others
  • Downstream plugin crashes
  • DAW mixer corruption

Corroborated by: 2/8 audit agents (stability-edge, dsp-algorithm)

Suggested Fix

Add a final-stage sanitizer at the end of the per-sample loop in processBlock:

for (int ch = 0; ch < numChannels; ++ch) {
    if (!std::isfinite(channelPtrs[ch][i]))
        channelPtrs[ch][i] = 0.0f;
}

This is a single branch per sample per channel -- negligible cost, significant safety benefit. Professional plugins universally include this kind of output sanitization.

Impact

  • Stability: Prevents corrupted audio output from reaching the DAW
  • Severity: High -- safety net for all other numerical edge cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions