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

Commit cdf924a3 authored by Eric Laurent's avatar Eric Laurent
Browse files

audio flinger: add check in getInputBufferSize()

Make sure that the sample rate passed to getInputBufferSize()
is not 0 to avoid divide by 0 in destinationFramesPossible()

Also check the channel mask parameter for validity.

bug: 26866012
Change-Id: Ifabbf56cadb0db104f99230cacdba30e0c6a0a3a
parent da53ce37
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1161,7 +1161,9 @@ size_t AudioFlinger::getInputBufferSize(uint32_t sampleRate, audio_format_t form
    if (ret != NO_ERROR) {
        return 0;
    }
    if (!audio_is_valid_format(format) || !audio_is_linear_pcm(format)) {
    if ((sampleRate == 0) ||
            !audio_is_valid_format(format) || !audio_is_linear_pcm(format) ||
            !audio_is_input_channel(channelMask)) {
        return 0;
    }