<p>On line 366 and following:</p>
<pre><code>    case ControlCmd: /* Read a control command */
      channel = (dwParam1 >> 8) & 0xFF;
      value =  (dwParam1 >> 16) & 0xFF;
      port->cache.sqControllers[channel] = value;
</code></pre>
<p>channel may reach a value of 255 (0xFF).<br>
but the cache is dimensionned 128 near line 142:</p>
<pre><code>/***************************************************************
 * Controller value caches -- This is the minimum complement
 * A "larger" driver would cache 128*16 controllers and 128*16 key pressures
 */
typedef struct sqControllerCache {
  unsigned char sqControllers[128];  /* Controller value table */
  unsigned char sqKeyPressures[128]; /* Polyphonic key pressure table */
  unsigned char sqChanPressures[16]; /* Channel pressure value table */
  int sqPitchBend[16];               /* The value of the pitch wheel */
} sqControllerCache;
</code></pre>
<p>Maybe use & 0x7F to be sure?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/336">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AhLyW8ptNwD9nV3DNs5zTuB21BDleYdkks5u-9dwgaJpZM4ZmCoP">mute the thread</a>.<img src="https://github.com/notifications/beacon/AhLyW3jqGPHG8MTPWfXppxQlFcVoUAwNks5u-9dwgaJpZM4ZmCoP.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Potential buffer overrun in sqwin32midi.c (IntelliSense C6386) (#336)"}],"action":{"name":"View Issue","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/336"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/336",
"url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/336",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>