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

Commit b6cf6d6a authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE Fix divide by zero" into lmp-mr1-dev

parents cd195030 bc08b17c
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -468,7 +468,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) {
@@ -885,6 +886,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 %" PRIu64 " bytes long.", chunk_size);

@@ -907,6 +912,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;
@@ -930,6 +939,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;
                }
            }
@@ -1272,7 +1285,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {

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

@@ -1836,6 +1849,10 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
        {
            *offset += chunk_size;

            if (depth != 1) {
                ALOGE("mvhd: depth %d", depth);
                return ERROR_MALFORMED;
            }
            if (chunk_data_size < 32) {
                return ERROR_MALFORMED;
            }