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

Commit caa578a8 authored by Ivan Lozano's avatar Ivan Lozano
Browse files

Fix integer sanitizer in audiopolicyservice.

A size_t was being converted to a ssize_t after an intended overflow
had already occurred. This makes the conversion explicit.

unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned
int'

Test: Compiled with the change and checked the sanitizer output.
Bug: 30969751
Change-Id: Ic15cc4b5d8295e14e3588ffa240830f7570dcaf3
Merged-In: Ic15cc4b5d8295e14e3588ffa240830f7570dcaf3
parent 240201e2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -859,7 +859,7 @@ void AudioPolicyService::AudioCommandThread::insertCommand_l(sp<AudioCommand>& c
    }

    // check same pending commands with later time stamps and eliminate them
    for (i = mAudioCommands.size()-1; i >= 0; i--) {
    for (i = (ssize_t)mAudioCommands.size()-1; i >= 0; i--) {
        sp<AudioCommand> command2 = mAudioCommands[i];
        // commands are sorted by increasing time stamp: no need to scan the rest of mAudioCommands
        if (command2->mTime <= command->mTime) break;