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

Commit ad107485 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Avoid overflow in metadataretriever

Bug: 123239050
Test: PoC
Change-Id: I452e267e69471dbcb21c989dc7f6edf10de214f9
parent 8bd3f093
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -638,7 +638,8 @@ void StagefrightMetadataRetriever::parseMetaData() {
    }

    // The duration value is a string representing the duration in ms.
    sprintf(tmp, "%" PRId64, (maxDurationUs + 500) / 1000);
    sprintf(tmp, "%" PRId64,
           (maxDurationUs > (INT64_MAX - 500) ? INT64_MAX : (maxDurationUs + 500)) / 1000);
    mMetaData.add(METADATA_KEY_DURATION, String8(tmp));

    if (hasAudio) {