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

Commit 1b35dd6e authored by Ivan Lozano's avatar Ivan Lozano
Browse files

Fix sanitizer in audioflinger Threads.cpp.

In RecordThread::start(), an unsigned integer is negated before being
set to mFramesToDrop (which is ssize_t). This causes a runtime error on
integer sanitized builds.

 runtime error: negation of 1323000 cannot be represented in type
 'unsigned int'

This makes the conversion to ssize_t explicitly occur before the
negation.

Bug: 30969751
Test: Compiles.
Change-Id: I9cf2e31728ff715c9755f257c1abf10fa5efbf82
parent eda72c27
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -6874,7 +6874,7 @@ status_t AudioFlinger::RecordThread::start(RecordThread::RecordTrack* recordTrac
            recordTrack->clearSyncStartEvent();
            recordTrack->clearSyncStartEvent();
        } else {
        } else {
            // do not wait for the event for more than AudioSystem::kSyncRecordStartTimeOutMs
            // do not wait for the event for more than AudioSystem::kSyncRecordStartTimeOutMs
            recordTrack->mFramesToDrop = -
            recordTrack->mFramesToDrop = -(ssize_t)
                    ((AudioSystem::kSyncRecordStartTimeOutMs * recordTrack->mSampleRate) / 1000);
                    ((AudioSystem::kSyncRecordStartTimeOutMs * recordTrack->mSampleRate) / 1000);
        }
        }
    }
    }