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

Commit 8f76b5cf authored by o.v.yevtushenko's avatar o.v.yevtushenko Committed by Oleksandr Yevtushenko
Browse files

Fix bad command length calculation



SET_LAYER_PER_FRAME_METADATA_BLOBS command length
was calculated wrong. With wrong length
it's impossible to read current and any next commands right.

Test: manual
Bug: 144367999

Change-Id: I09a23bbf507996972ce7de0634f8866bbb13152a
Signed-off-by: default avataro.v.yevtushenko <o.v.yevtushenko@globallogic.com>
parent bbdd5e32
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