Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02fd2797 authored by rago's avatar rago
Browse files

Fix Auxiliary Effect Buffer Corruption

Output buffer is shared with temp buffer. Conversion should go low to
high indexes in array to avoid corruption.

Bug: 65375387

Test: Manual testing with SoloTester app.
Change-Id: I1b96e6c625d2b0a857f029e493b5fcb22bf02ece
parent 90153cae
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -429,9 +429,7 @@ static void FloatToInt16_SAT(const LVM_FLOAT *src, LVM_INT16 *dst, size_t n) {
    size_t ii;
    LVM_INT32 temp;

    src += n-1;
    dst += n-1;
    for (ii = n; ii != 0; ii--) {
    for (ii = 0; ii < n; ii++) {
        temp = (LVM_INT32)((*src) * 32768.0f);
        if (temp >= 32767) {
            *dst = 32767;
@@ -440,8 +438,8 @@ static void FloatToInt16_SAT(const LVM_FLOAT *src, LVM_INT16 *dst, size_t n) {
        } else {
            *dst = (LVM_INT16)temp;
        }
        src--;
        dst--;
        src++;
        dst++;
    }
    return;
}