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

Commit b61a0706 authored by Arve Hjønnevåg's avatar Arve Hjønnevåg
Browse files

libbinder Parcel: Fix ubsan error in readData

Use don't cast the result of readInplace before calling memcpy to align
the data. With clang-r522817 passing an unaligned pointer to memcpy also
triggers a ubsan error.

Bug: 354981705
Change-Id: Ibd104bcfac519211857f1e9e93a1ec35e7bcd773
parent 9333e35a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1240,7 +1240,7 @@ private:
            if (__builtin_mul_overflow(size, sizeof(T), &dataLen)) {
                return -EOVERFLOW;
            }
            auto data = reinterpret_cast<const T*>(readInplace(dataLen));
            auto data = readInplace(dataLen);
            if (data == nullptr) return BAD_VALUE;
            // std::vector::insert and similar methods will require type-dependent
            // byte alignment when inserting from a const iterator such as `data`,