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

Commit dafa42d4 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Fail gracefully if sample table chunk index is out of range

instead of asserting

Bug: 23534160
Change-Id: I749fab9e5dc2cae9d3c1e2cac0fb9818e1b8e94f
parent fdfbc461
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -250,8 +250,11 @@ status_t SampleTable::setSampleToChunkParams(
                != (ssize_t)sizeof(buffer)) {
            return ERROR_IO;
        }

        CHECK(U32_AT(buffer) >= 1);  // chunk index is 1 based in the spec.
        // chunk index is 1 based in the spec.
        if (U32_AT(buffer) < 1) {
            ALOGE("b/23534160");
            return ERROR_OUT_OF_RANGE;
        }

        // We want the chunk index to be 0-based.
        mSampleToChunkEntries[i].startChunk = U32_AT(buffer) - 1;