Add bound checks to utf16_to_utf8
am: 0c9742db80

Change-Id: Iacb2248ca498ae3b0ec699c44218963b97405b3b