mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
fix(amd64-386): sample oscillator hard crash
The sample-based oscillators converted the samplepos to an integer and did samplepos < loop_end comparison to check if we are past looping. Unfortunately, the < comparison was done in signed math. Normally, this should never happen, but if the x87 FPU stack overflowed exactly at right position, we then got 0x80000000 in samplepos, which is equal to -2147483648. Thus, we considered that sample is not looping and read the sample table at position -2147483648, well out of bound. TL;DR changing jl to jb makes sure we always wrap within to sample table, no matter what. Fixes #149.
This commit is contained in:
parent
4ee355bb45
commit
0e10cd2ae8
@ -181,3 +181,8 @@ target_compile_definitions(test_render_samples PUBLIC TEST_HEADER="test_render_s
|
||||
add_executable(test_render_samples_api test_render_samples_api.c)
|
||||
target_link_libraries(test_render_samples_api ${STATICLIB})
|
||||
add_test(test_render_samples_api test_render_samples_api)
|
||||
|
||||
add_executable(test_oscillator_crash test_oscillator_crash.c)
|
||||
target_link_libraries(test_oscillator_crash ${STATICLIB})
|
||||
add_test(test_oscillator_crash test_oscillator_crash)
|
||||
|
||||
|
Reference in New Issue
Block a user