Add bound checks to utf16_to_utf8
am: 9b39ebe132

Change-Id: I1b3aa4ab0c3f6f4b577d10dda8ce9604d0fc4e9c