Skip to content

Commit

Permalink
Increase ibuffer padding to avoid reading out of bounds on 24bit audio
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHarker committed Oct 26, 2023
1 parent e9fb865 commit eb47f75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ibuffer suite/ibuffer~/ibuffer~.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,11 @@ void ibuffer_load_internal(t_ibuffer *x, t_symbol *s, short argc, t_atom *argv)
long num_chans_to_load = channel_order.size() ? static_cast<long>(channel_order.size()) : x->channels;
long sample_size = file.getByteDepth();

// Padding accounts for cubic interpolation and possible 24 bit offsets

free(x->memory);
x->memory = calloc(((num_frames + 4) * num_chans_to_load), sample_size);
x->samples = reinterpret_cast<uint8_t *>(x->memory) + (num_chans_to_load * sample_size);
x->memory = calloc(((num_frames + 4) * num_chans_to_load + 8), sample_size);
x->samples = reinterpret_cast<uint8_t *>(x->memory) + (num_chans_to_load * sample_size) + 4;

// Bail if no memory

Expand Down

0 comments on commit eb47f75

Please sign in to comment.