Skip to content

NormalisableRange: Do not let a value that is no number pass as normalised - #1751

Open
yumasansansan wants to merge 1 commit into
juce-framework:developfrom
yumasansansan:parameter-not-a-number
Open

yumasansansan wants to merge 1 commit into
juce-framework:developfrom
yumasansansan:parameter-not-a-number

Conversation

@yumasansansan

Copy link
Copy Markdown

NormalisableRange::clampTo0To1() holds a normalised value between nought and one with jlimit(), which hands back a value that is neither below nought nor above one. A value that is no number is neither, because every comparison with it is false, so it comes through -- and the jassert on the next line, which says that a value outside the expected bounds is a fault, is not in the builds a host loads.

What it reaches is the plug-in. AudioParameterFloat::setValue() converts it and stores it, get() hands it back, and a plug-in that multiplies its audio by a parameter then writes samples that are no numbers into the host's buffer. AudioParameterInt::get() and AudioParameterChoice::getIndex() convert it to an int, which is undefined for a value that is no number. A host has no business sending one, but a host is where a plug-in's values come from, and nothing else on the way looks.

A proportion of nought, the bottom of the range, is the nearest value to it that is a value. The assertion stays where it is and still fires, so a Debug build says what happened as it did before; a release build carries on with a number. Every value that is a number, inside the range or outside it, comes out exactly as it came out before.

A fuzz target of ADLplug-Next found it: it does to the plug-in what a host does while it is loaded, and writes four bytes of its input into a parameter as the bits of a float before asking for a block of audio. The check that every sample the plug-in writes is a finite number failed on the first such value, where the parameter was the master volume that every sample is multiplied by.

It is in 9.0.2 and in develop as it stands, and it is independent of the commits of ours that are already open (#1749, #1750).

…lised

clampTo0To1() holds a normalised value between nought and one with jlimit(), which hands back a value that is neither below nought nor above one. A value that is no number is neither, because every comparison with it is false, so it comes through -- and the assertion on the next line, which says that a value outside the expected bounds is a fault, is not in the builds a host loads.

What it reaches is the plug-in. AudioParameterFloat::setValue() converts it and stores it, get() hands it back, and a plug-in that multiplies its audio by a parameter then writes samples that are no numbers into the host's buffer. AudioParameterInt::get() and AudioParameterChoice::getIndex() convert it to an int, which is undefined for a value that is no number. A host has no business sending one, but a host is where a plug-in's values come from, and nothing else on the way looks.

A proportion of nought, the bottom of the range, is the nearest value to it that is a value. The assertion stays where it is and still fires, so a Debug build says what happened as it did before; a release build carries on with a number. Every value that is a number, inside the range or outside it, comes out exactly as it came out before.

A fuzz target of ADLplug-Next found it, one that does to the plug-in what a host does while it is loaded: it writes four bytes of its input into a parameter as the bits of a float and then asks for a block of audio. The check that every sample the plug-in writes is a finite number failed on the first such value, where the parameter was the master volume that every sample is multiplied by.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant