gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 47d1300719df53cebba4f0c88b13fdd9c25d2238
parent 4bc535b86eca64fb363049decf001d0e1bdc4a01
Author: dsp56300 <lyve2909+githubdsp56300@gmail.com>
Date:   Wed, 14 Jul 2021 19:40:47 +0200

fix memory corruption when changing parameters

Diffstat:
Msource/virusLib/microcontroller.cpp | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/source/virusLib/microcontroller.cpp b/source/virusLib/microcontroller.cpp @@ -582,7 +582,13 @@ void Microcontroller::applyToSingleEditBuffer(const Page _page, const uint8_t _p void Microcontroller::applyToSingleEditBuffer(TPreset& _single, const Page _page, const uint8_t _param, const uint8_t _value) { // The manual does not have a Single dump specification, therefore I assume that its a 1:1 mapping of pages A and B - _single[_page * 128 + _param] = _value; + + const uint32_t offset = (_page - PAGE_A) * 128 + _param; + + if(offset >= _single.size()) + return; + + _single[offset] = _value; } void Microcontroller::applyToMultiEditBuffer(const uint8_t _part, const uint8_t _param, const uint8_t _value)