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

Commit 3b938b6c authored by Chad Brubaker's avatar Chad Brubaker Committed by Android Git Automerger
Browse files

am 49bf1193: Merge "Fix benign overflow in AudioTrackShared"

* commit '49bf1193':
  Fix benign overflow in AudioTrackShared
parents 72497b7c 49bf1193
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -38,7 +38,7 @@ size_t clampToSize(T x) {
// In general, this means (new_self) returned is max(self, other) + 1.
// In general, this means (new_self) returned is max(self, other) + 1.


static uint32_t incrementSequence(uint32_t self, uint32_t other) {
static uint32_t incrementSequence(uint32_t self, uint32_t other) {
    int32_t diff = self - other;
    int32_t diff = (int32_t) self - other;
    if (diff >= 0 && diff < INT32_MAX) {
    if (diff >= 0 && diff < INT32_MAX) {
        return self + 1; // we're already ahead of other.
        return self + 1; // we're already ahead of other.
    }
    }