ftsf / nico

a Game Framework in Nim inspired by Pico-8.
MIT License
630 stars 36 forks source link

Audio example: Channel adjust in song view can get out of valid range #45

Closed jorisbontje closed 3 years ago

jorisbontje commented 3 years ago

With examples/audio.nim in nico v0.3.2 on OSX: Using pcA+pcUp / pcA+pcDown to adjust the channel in the song view can cause the channel to get out of the valid range [0..64]. This seems to be due to incorrect boundary checks in audio.nim gameUpdate(126-130).

Resulting stack trace:

~/nico/examples/audio.nim(345) audio
~/.nimble/pkgs/nico-0.3.2/nico.nim(2935) run
~/.nimble/pkgs/nico-0.3.2/nico/backends/sdl2.nim(1662) run
~/.nimble/pkgs/nico-0.3.2/nico/backends/sdl2.nim(1272) step
~/.nimble/pkgs/nico-0.3.2/nico/backends/sdl2.nim(1519) queueMixerAudio
~/nico/examples/audio.nim(40) musicUpdate
~/.choosenim/toolchains/nim-1.4.2/lib/system/fatal.nim(49) sysFatal
Error: unhandled exception: index 240 not in 0 .. 63 [IndexDefect]
Error: execution of an external program failed: '~/nico/examples/audio '