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

Commit c1768c9d authored by Wei Jia's avatar Wei Jia Committed by Android Git Automerger
Browse files

am 268b9692: am 9a4da6b1: am c98f2a0a: am e0095a19: am 86174e2c: Merge...

am 268b9692: am 9a4da6b1: am c98f2a0a: am e0095a19: am 86174e2c: Merge "Prevent reading past the end of the buffer in 3GPP" into lmp-dev

* commit '268b9692':
  Prevent reading past the end of the buffer in 3GPP
parents a2a912a7 268b9692
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2398,11 +2398,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;
    }
@@ -2498,6 +2498,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.