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

Commit 86174e2c authored by Wei Jia's avatar Wei Jia Committed by Android (Google) Code Review
Browse files

Merge "Prevent reading past the end of the buffer in 3GPP" into lmp-dev

parents 4d8ed149 d89104a3
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2395,11 +2395,11 @@ status_t MPEG4Extractor::parseITunesMetaData(off64_t offset, size_t size) {
}

status_t MPEG4Extractor::parse3GPPMetaData(off64_t offset, size_t size, int depth) {
    if (size < 4) {
    if (size < 4 || size == SIZE_MAX) {
        return ERROR_MALFORMED;
    }

    uint8_t *buffer = new (std::nothrow) uint8_t[size];
    uint8_t *buffer = new (std::nothrow) uint8_t[size + 1];
    if (buffer == NULL) {
        return ERROR_MALFORMED;
    }
@@ -2495,6 +2495,7 @@ status_t MPEG4Extractor::parse3GPPMetaData(off64_t offset, size_t size, int dept
        }

        if (isUTF8) {
            buffer[size] = 0;
            mFileMetaData->setCString(metadataKey, (const char *)buffer + 6);
        } else {
            // Convert from UTF-16 string to UTF-8 string.