uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 798ebafdc8c27529217f159f8ff53edb0a8a328f
parent 6381ebb5454b9f8b792ca54066e4cde99d713524
Author: Bad Diode <bd@badd10de.dev>
Date:   Mon, 23 Oct 2023 11:10:03 +0200

Fix potential out of bounds when doing tuning lookup

Diffstat:
Msrc/devices/audio.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/devices/audio.c b/src/devices/audio.c @@ -132,9 +132,6 @@ note_on(AudioChannel *channel, float duration, Uint8 *data, Uint16 len, Uint8 vo sample.loop = 0; } env_on(&sample.env); - if(pitch < 20) { - pitch = 20; - } float sample_rate = 44100 / 261.60; if(len <= 256) { sample_rate = len; @@ -305,6 +302,9 @@ audio_start(int idx, Uint8 *d, Uxn *u) Uint8 off = d[0xf] == 0x00; Uint16 len = PEEK2(d + 0xa); Uint8 pitch = d[0xf] & 0x7f; + if(pitch < 20) { + pitch = 20; + } float duration = dur > 0 ? dur : calc_duration(len, pitch); if(!off) {