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

Commit f7f2c17e authored by Andrei Homescu's avatar Andrei Homescu
Browse files

libbinder: Fix PAD_SIZE_UNSAFE

Building libbinder with UBSan on Trusty revealed an error
in the PAD_SIZE_UNSAFE macro.

Bug: None
Test: m
Change-Id: I3b0968488eb43f5aae02fcf3813e9948362e1749
parent 8da6741a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@
// This macro should never be used at runtime, as a too large value
// of s could cause an integer overflow. Instead, you should always
// use the wrapper function pad_size()
#define PAD_SIZE_UNSAFE(s) (((s)+3)&~3)
#define PAD_SIZE_UNSAFE(s) (((s) + 3) & ~3UL)

static size_t pad_size(size_t s) {
    if (s > (std::numeric_limits<size_t>::max() - 3)) {