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

Commit 1b3f61ce authored by Marco Nelissen's avatar Marco Nelissen Committed by android-build-merger
Browse files

DO NOT MERGE Fix divide by zero am: febbd52c

am: 55ce7e5d

Change-Id: I792667b35aacfa1b910a332d855f002615041408
parents 24566f29 55ce7e5d
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -459,7 +459,8 @@ sp<MetaData> MPEG4Extractor::getTrackMetaData(
            } else {
                uint32_t sampleIndex;
                uint32_t sampleTime;
                if (track->sampleTable->findThumbnailSample(&sampleIndex) == OK
                if (track->timescale != 0 &&
                        track->sampleTable->findThumbnailSample(&sampleIndex) == OK
                        && track->sampleTable->getMetaDataForSample(
                            sampleIndex, NULL /* offset */, NULL /* size */,
                            &sampleTime) == OK) {
@@ -850,6 +851,10 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
        case FOURCC('s', 'c', 'h', 'i'):
        case FOURCC('e', 'd', 't', 's'):
        {
            if (chunk_type == FOURCC('m', 'o', 'o', 'v') && depth != 0) {
                ALOGE("moov: depth %d", depth);
                return ERROR_MALFORMED;
            }
            if (chunk_type == FOURCC('s', 't', 'b', 'l')) {
                ALOGV("sampleTable chunk is %d bytes long.", (size_t)chunk_size);

@@ -872,6 +877,10 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {

            bool isTrack = false;
            if (chunk_type == FOURCC('t', 'r', 'a', 'k')) {
                if (depth != 1) {
                    ALOGE("trak: depth %d", depth);
                    return ERROR_MALFORMED;
                }
                isTrack = true;

                Track *track = new Track;
@@ -895,6 +904,10 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
            while (*offset < stop_offset) {
                status_t err = parseChunk(offset, depth + 1);
                if (err != OK) {
                    if (isTrack) {
                        mLastTrack->skipTrack = true;
                        break;
                    }
                    return err;
                }
            }
@@ -1229,10 +1242,6 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {

        case FOURCC('s', 't', 's', 'd'):
        {
            if (chunk_data_size < 8) {
                return ERROR_MALFORMED;
            }

            uint8_t buffer[8];
            if (chunk_data_size < (off64_t)sizeof(buffer)) {
                return ERROR_MALFORMED;
@@ -1757,6 +1766,10 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {

        case FOURCC('m', 'v', 'h', 'd'):
        {
            if (depth != 1) {
                ALOGE("mvhd: depth %d", depth);
                return ERROR_MALFORMED;
            }
            if (chunk_data_size < 24) {
                return ERROR_MALFORMED;
            }