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

Commit 2e81b588 authored by Dan Liang's avatar Dan Liang
Browse files

Fix div zero error in corrupted media file



Some corrupted media file has timescale value as zero and shouldn't be used.

Change-Id: I8f6a347f8651cdc7e8c370ab1881e1a5fcb30839
Signed-off-by: default avatarDan Liang <dan.liang@intel.com>
parent ddd1c72b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1172,6 +1172,11 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                return ERROR_IO;
            }

            if (!timescale) {
                ALOGE("timescale should not be ZERO.");
                return ERROR_MALFORMED;
            }

            mLastTrack->timescale = ntohl(timescale);

            // 14496-12 says all ones means indeterminate, but some files seem to use
@@ -2636,6 +2641,11 @@ status_t MPEG4Extractor::verifyTrack(Track *track) {
        return ERROR_MALFORMED;
    }

    if (track->timescale == 0) {
        ALOGE("timescale invalid.");
        return ERROR_MALFORMED;
    }

    return OK;
}