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

Commit 196c22da authored by Antoine Soulier's avatar Antoine Soulier Committed by Jakub Pawlowski
Browse files

fix sanitizer: buffer pointer crossed results in negative unsigned difference

Bug: 221166532
Test: run liblc3_fuzzer
Change-Id: I5c529e61bbf5c062887fa2e8090e3b13674d540e
parent 2f27ccba
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -69,8 +69,9 @@ static int get_bits_left(const struct lc3_bits *bits)
    uintptr_t start = (uintptr_t)buffer->p_fw -
        (bits->mode == LC3_BITS_MODE_READ ? LC3_AC_BITS/8 : 0);

    return 8 * (end - start) -
        (accu->n + accu->nover + ac_get_pending_bits(ac));
    int n = end > start ? (int)(end - start) : -(int)(start - end);

    return 8 * n - (accu->n + accu->nover + ac_get_pending_bits(ac));
}

/**