Add bound checks to utf16_to_utf8 am: 0c9742db80
am: c0a1a3187c

Change-Id: I050e58df0250e5d685b03c3e572bb756e9f997f0