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

Commit 425b39f8 authored by Peiyong Lin's avatar Peiyong Lin Committed by android-build-merger
Browse files

Merge "Fix bad command length calculation" am: b44c4d4c am: 97a0f117

am: 7fcc448a

Change-Id: Id84ccd01a2aff67986796b96fa423e2cc7ccea8c
parents 4fffa4a9 7fcc448a
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ class CommandWriterBase : public V2_2::CommandWriterBase {

    void setLayerPerFrameMetadataBlobs(
        const hidl_vec<IComposerClient::PerFrameMetadataBlob>& metadata) {
        // in units of uint32_t's
        size_t commandLength = 0;

        if (metadata.size() > std::numeric_limits<uint32_t>::max()) {
@@ -86,11 +87,11 @@ class CommandWriterBase : public V2_2::CommandWriterBase {
            return;
        }

        // number of blobs
        commandLength += metadata.size();
        // space for numElements
        commandLength += 1;

        for (auto metadataBlob : metadata) {
            commandLength += sizeof(int32_t);  // key of metadata blob
            commandLength += 1;  // key of metadata blob
            commandLength += 1;  // size information of metadata blob

            // metadata content size