forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Synthio has one (and likely more) spots where it is possible to overflow the int32_t
used as an intermediary while doing fixed point math.
This function multiplies an int32_t by int16_t which can exceed the 32 bit size.
static void sum_with_loudness(int32_t *out_buffer32, int32_t *tmp_buffer32, int16_t loudness[2], size_t dur, int synth_chan) { |
There are likely other cases as well.
The probable fix is to add a function to ensure the values are saturated after every calculation.
audiofreeverb
does this
static int16_t sat16(int32_t n, int rshift) { |
This issue is most likely the cause for #10200.