Skip to content

Commit

Permalink
Update cybuf.c
Browse files Browse the repository at this point in the history
  • Loading branch information
porres committed Aug 1, 2024
1 parent 22f40da commit 694caf4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shared/signal/cybuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void *cybuf_init(t_class *owner, t_symbol *bufname, int numchans, int singlemode
c->c_single = singlemode;
c->c_owner = owner;
c->c_npts = 0;
c->c_vectors = vectors;
c->c_vectors = (t_word**)vectors;
c->c_channames = channames;
c->c_disabled = 0;
c->c_playable = 0;
Expand Down

1 comment on commit 694caf4

@umlaeute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems wrong.
if c->c_vectors is of type t_word**, then you must not assign a t_float** value (like vectors) to it.
instead vectors must be turned into a t_word** as well (and initialized as such).

note that sizeof(t_float) is typically 4 (for single-precision Pd), and sizeof(t_word) is typically 8 (on 64bit systems).
so you will mostly underallocate data.

(the bug has been present before, but your typecast now tells the compiler to explicitly ignore the problem)

Please sign in to comment.