NormalisableRange: Do not let a value that is no number pass as normalised - #1751
Open
yumasansansan wants to merge 1 commit into
Open
yumasansansan wants to merge 1 commit into
yumasansansan wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NormalisableRange::clampTo0To1()holds a normalised value between nought and one withjlimit(), 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 thejasserton 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()andAudioParameterChoice::getIndex()convert it to anint, 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
developas it stands, and it is independent of the commits of ours that are already open (#1749, #1750).