libutils: fix overflow in SharedBuffer [DO NOT MERGE]

See
https://code.google.com/p/android/issues/detail?id=181910

Bug: 22952485
(cherry picked from commit 66b6eb9490beeeabc804d790c1c4060ce047afd4)

Change-Id: I363f49b5b3c6b7b3ac08cba2c14d72c431588c5a
3 files changed