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

Commit 1b41d449 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Avoid reading at negative offsets

PlayerServiceFileSource had the same logic as FileSource that could
cause reading at negative data source offsets, so fix that too.

Test: build
Bug: 141242340
Change-Id: I60226d85ece83339444d9ec1c0a741271e33e127
parent 04e4465a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -71,6 +71,9 @@ ssize_t PlayerServiceFileSource::readAt(off64_t offset, void *data, size_t size)
    Mutex::Autolock autoLock(mLock);

    if (mLength >= 0) {
        if (offset < 0) {
            return UNKNOWN_ERROR;
        }
        if (offset >= mLength) {
            return 0;  // read beyond EOF.
        }