pierreguillot / Camomile

An audio plugin with Pure Data embedded that allows to load and to control patches
GNU General Public License v3.0
892 stars 62 forks source link

makePresetsFile(): plugin parameters should be indexed by j, not i #294

Closed hyperpenelope closed 1 year ago

hyperpenelope commented 2 years ago

In the method makePresetsFile(), the variable i is used to loop over every preset which is being saved. Variable j is used in an inner loop to loop over plugin parameters. However, the array params was being accessed using i as an index, rather than j.

If you have, e.g. 4 presets for a plugin that accepts 2 parameters, the previous code tries to access params[2] and params[3], which are out of bounds because there are only 2 parameters. This was leading to segfaults when I built the Bulgroz and Castafiore plugins.

pierreguillot commented 1 year ago

I think it has been merged with https://github.com/pierreguillot/Camomile/pull/295.