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

Commit 36e45afe authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Really fix end-of-stream handling in OggExtractor

Bug: 122496376
Bug: 122805825
Test: CTS, manual
Change-Id: I486b8c81bb8e21b54d9eb835eb9b25737d8b0102
parent d827ceaf
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -515,10 +515,10 @@ ssize_t MyOggExtractor::readPage(off64_t offset, Page *page) {
        ALOGV("failed to read %zu bytes at offset %#016llx, got %zd bytes",
                sizeof(header), (long long)offset, n);

        if (n < 0) {
            return n;
        } else if (n == 0) {
        if (n == 0 || n == ERROR_END_OF_STREAM) {
            return AMEDIA_ERROR_END_OF_STREAM;
        } else if (n < 0) {
            return AMEDIA_ERROR_UNKNOWN;
        } else {
            return AMEDIA_ERROR_IO;
        }
@@ -872,7 +872,7 @@ media_status_t MyOggExtractor::_readNextPacket(MediaBufferHelper **out, bool cal

            ALOGV("readPage returned %zd", n);

            return n < 0 ? (media_status_t) n : AMEDIA_ERROR_END_OF_STREAM;
            return (media_status_t) n;
        }

        // Prevent a harmless unsigned integer overflow by clamping to 0