Add bound checks to utf16_to_utf8 am: 9b39ebe132
am: 856a04b27e

Change-Id: I4b2aacd4309f4360937ea90bd24d9b47669624bb