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

Commit 2f5f0ace authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Don't read more than the buffer size.

Bug: 130593895
Test: manual
Change-Id: I54612d14e7cadde1d4a447040dbe9086e970c549
parent 669dda14
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -461,7 +461,7 @@ media_status_t WAVSource::read(
    }

    // maxBytesToRead may be reduced so that in-place data conversion will fit in buffer size.
    const size_t bufferSize = buffer->size();
    const size_t bufferSize = std::min(buffer->size(), kMaxFrameSize);
    size_t maxBytesToRead;
    if (mOutputFloat) { // destination is float at 4 bytes per sample, source may be less.
        maxBytesToRead = (mBitsPerSample / 8) * (bufferSize / 4);