Add bound checks to utf16_to_utf8 am: bce11021b2
am: 008120497b

Change-Id: Ib3135f8f186b10b773592d2bcbeae398cfd2fee1