SunVoxLib 2.0e, 2.1 - memory violation [FIXED in 2.1b]

Found a bug? Post it here.
Post Reply
User avatar
Sotakebk
Posts: 16
Joined: Thu Nov 03, 2022 8:52 pm

SunVoxLib 2.0e, 2.1 - memory violation [FIXED in 2.1b]

Post by Sotakebk »

A memory violation sometimes (!) occurs when calling sv_audio_callback(). It only happens every few program runs.

Scenario: I iterate over existing modules and their controllers, reading the controller name, sending 0x0, forcing event processing via sv_audio_callback(), reading the value, sending 0x8000, calling sv_audio_callback(), and reading again. This was made before new API was available, and seemed like a good idea. I also do a few other calls and locks, but they don't seem to matter.
image_2023-02-02_142115491.png
image_2023-02-02_142115491.png (34.47 KiB) Viewed 3010 times
Attached callstack is for SunVox library 2.1. I attempted to try looking at disassembly, to see if I was sending wrong data somehow, but the fault seems to happen very late into the sv_audio_callback procedure.
I also may send you the memory dump if you wish, and may try to generate a list of calls made to the library along with their timestamps.
Of note is that everything seems to be fine if I sleep my calling thread for a bit between calls.
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVoxLib 2.0e, 2.1 - memory violation

Post by NightRadio »

What flags do you use in sv_init()?
User avatar
Sotakebk
Posts: 16
Joined: Thu Nov 03, 2022 8:52 pm

Re: SunVoxLib 2.0e, 2.1 - memory violation

Post by Sotakebk »

SV_INIT_FLAG_USER_AUDIO_CALLBACK, SV_INIT_FLAG_AUDIO_FLOAT32, SV_INIT_FLAG_ONE_THREAD

Still happens without SV_INIT_FLAG_ONE_THREAD on both 2.0e and 2.1
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVoxLib 2.0e, 2.1 - memory violation

Post by NightRadio »

Thanks!
I found 686DDDCC in the code :)
This is access to one of the harmonics in the SpectraVoice. And it looks like you can write any value to controller 09, and this is not limited in any way... While the maximum value is 15. And this is a very simple way to crash the app from a pattern with a couple of commands...
Will be fixed in 2.1b
Post Reply