Add bound checks to utf16_to_utf8 am: 9b39ebe132
am: 05cd88ab69

Change-Id: I89bf34b8c156497bffc486a89723d65958316f56