ref: f894f24bcd63dc8b2a0604a9b659dd95aebbb384
parent: b600e190fd4593faed8c14da776c991e99e8c86c
author: Simon Howard <[email protected]>
date: Sun Sep 20 17:19:37 EDT 2009
Avoid possible overflow due to base note offset. Subversion-branch: /branches/opl-branch Subversion-revision: 1683
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -934,6 +934,13 @@
gm_voice = &voice->current_instr->voices[voice->current_instr_voice];
note += (signed short) SHORT(gm_voice->base_note_offset);
+ // Avoid possible overflow due to base note offset:
+
+ if (note > 0x7f)
+ {
+ note = voice->note;
+ }
+
freq_index = 64 + 32 * note + voice->channel->bend;
// If this is the second voice of a double voice instrument, the