1
0
Fork 0

Clarify buffer_is_valid check

This commit is contained in:
Robbert van der Helm 2023-02-26 00:56:39 +01:00
parent 3a9b3281e8
commit 2580953b87
2 changed files with 2 additions and 0 deletions

View file

@ -2037,6 +2037,7 @@ impl<P: ClapPlugin> Wrapper<P> {
{ {
let audio_outputs = &*process.audio_outputs; let audio_outputs = &*process.audio_outputs;
let num_output_channels = audio_outputs.channel_count as usize; let num_output_channels = audio_outputs.channel_count as usize;
// This ensures that we never feed dangling slices to the wrapped plugin
buffer_is_valid = num_output_channels == output_slices.len(); buffer_is_valid = num_output_channels == output_slices.len();
nih_debug_assert_eq!(num_output_channels, output_slices.len()); nih_debug_assert_eq!(num_output_channels, output_slices.len());

View file

@ -1302,6 +1302,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
if !data.outputs.is_null() { if !data.outputs.is_null() {
let num_output_channels = (*data.outputs).num_channels as usize; let num_output_channels = (*data.outputs).num_channels as usize;
// This ensures that we never feed dangling slices to the wrapped plugin
buffer_is_valid = num_output_channels == output_slices.len(); buffer_is_valid = num_output_channels == output_slices.len();
nih_debug_assert_eq!(num_output_channels, output_slices.len()); nih_debug_assert_eq!(num_output_channels, output_slices.len());