Skip to content

Commit

Permalink
MBSIDV3: prevent illegal pointer access in Arp after random number ge…
Browse files Browse the repository at this point in the history
…neration
  • Loading branch information
midibox committed Mar 2, 2019
1 parent f5ab9e8 commit 5225d4e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/synthesizers/midibox_sid_v3/core/sid_se.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,10 @@ s32 SID_SE_Arp(sid_se_voice_t *v)
// dir modes
u8 note_number = 0;
if( arp_mode.DIR >= 6 ) { // Random
note_number = SID_RANDOM_Gen_Range(0, mv->notestack.len-1);
if( mv->notestack.len > 0 )
note_number = SID_RANDOM_Gen_Range(0, mv->notestack.len-1);
else
note_number = 0;
} else {
u8 new_note_up;
if( arp_mode.DIR >= 2 && arp_mode.DIR <= 5 ) { // Alt Mode 1 and 2
Expand Down

0 comments on commit 5225d4e

Please sign in to comment.