mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
Cope with truncated utf8 input
This commit is contained in:
@@ -301,7 +301,13 @@ int utf8_in2(int *c, const char *buf, int backwards)
|
||||
|
||||
c1 &= mask[n_bytes];
|
||||
for (ix = 0; ix < n_bytes; ix++)
|
||||
{
|
||||
if (!*buf)
|
||||
/* Oops, truncated */
|
||||
break;
|
||||
c1 = (c1 << 6) + (*buf++ & 0x3f);
|
||||
}
|
||||
n_bytes = ix;
|
||||
}
|
||||
*c = c1;
|
||||
return n_bytes+1;
|
||||
|
||||
Reference in New Issue
Block a user