1
0
Fork 0

Fix null pointer assertions in buffer management

This commit is contained in:
Robbert van der Helm 2023-09-21 22:48:11 +02:00
parent c0a72661e1
commit 3f4d70c32a
2 changed files with 11 additions and 4 deletions

View file

@ -10,6 +10,13 @@ Since there is no stable release yet, the changes are organized per day in
reverse chronological order. The main purpose of this document in its current
state is to list breaking changes.
## [2023-05-21]
### Fixed
- Fixed null pointers assertions in the low level buffer management code not
working correctly.
## [2023-09-03]
### Added

View file

@ -191,9 +191,9 @@ impl BufferManager {
.enumerate()
.take(output_channel_pointers.num_channels)
{
assert!(!output_channel_pointers.ptrs.as_ptr().is_null());
let output_channel_pointer =
output_channel_pointers.ptrs.as_ptr().add(channel_idx);
assert!(!output_channel_pointer.is_null());
*output_slice = std::slice::from_raw_parts_mut(
(*output_channel_pointer).add(sample_offset),
@ -229,9 +229,9 @@ impl BufferManager {
.enumerate()
.take(input_channel_pointers.num_channels)
{
assert!(!input_channel_pointers.ptrs.as_ptr().is_null());
let input_channel_pointer =
input_channel_pointers.ptrs.as_ptr().add(channel_idx);
assert!(!input_channel_pointer.is_null());
output_slice.copy_from_slice(std::slice::from_raw_parts_mut(
(*input_channel_pointer).add(sample_offset),
@ -273,9 +273,9 @@ impl BufferManager {
.enumerate()
.take(input_channel_pointers.num_channels)
{
assert!(!input_channel_pointers.ptrs.as_ptr().is_null());
let input_channel_pointer =
input_channel_pointers.ptrs.as_ptr().add(channel_idx);
assert!(!input_channel_pointer.is_null());
nih_debug_assert!(num_samples <= channel.capacity());
channel.resize(num_samples, 0.0);
@ -334,9 +334,9 @@ impl BufferManager {
.enumerate()
.take(output_channel_pointers.num_channels)
{
assert!(!output_channel_pointers.ptrs.as_ptr().is_null());
let output_channel_pointer =
output_channel_pointers.ptrs.as_ptr().add(channel_idx);
assert!(!output_channel_pointer.is_null());
*output_slice = std::slice::from_raw_parts_mut(
(*output_channel_pointer).add(sample_offset),