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

Commit e59cb43e authored by Chad Brubaker's avatar Chad Brubaker
Browse files

Fix writeByteArray/writeInt32Array size on x64

writeByteArray writes the size using sizeof(size_t), however it is always
read using readInt32(). On devices where sizeof(size_t) != 4 this causes
extra bytes to be written.

BUG: 22204736
Change-Id: I8d4507b6b616857ef5827f1fe9da0907d09abf0e
parent fe608c5e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -735,9 +735,9 @@ status_t Parcel::writeInt32Array(size_t len, const int32_t *val) {
    }

    if (!val) {
        return writeAligned(-1);
        return writeInt32(-1);
    }
    status_t ret = writeAligned(len);
    status_t ret = writeInt32(static_cast<uint32_t>(len));
    if (ret == NO_ERROR) {
        ret = write(val, len * sizeof(*val));
    }
@@ -751,9 +751,9 @@ status_t Parcel::writeByteArray(size_t len, const uint8_t *val) {
    }

    if (!val) {
        return writeAligned(-1);
        return writeInt32(-1);
    }
    status_t ret = writeAligned(len);
    status_t ret = writeInt32(static_cast<uint32_t>(len));
    if (ret == NO_ERROR) {
        ret = write(val, len * sizeof(*val));
    }