p4raw-id: //depot/perl@14660
for (t = ustrp, tend = t + *lenp; t < tend; t += tlen) {
UV c = utf8_to_uvchr(t, &tlen);
- d = uvchr_to_utf8(d, UNI_TO_NATIVE(c));
+
+ if (tlen > 0)
+ d = uvchr_to_utf8(d, UNI_TO_NATIVE(c));
+ else
+ break;
}
*lenp = d - tmpbuf;
Copy(tmpbuf, ustrp, *lenp, U8);