Browse Source

Cope with truncated utf8 input

master
Samuel Thibault 2 years ago
parent
commit
ecec635b44
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      src/libespeak-ng/translate.c

+ 6
- 0
src/libespeak-ng/translate.c View File



c1 &= mask[n_bytes]; c1 &= mask[n_bytes];
for (ix = 0; ix < n_bytes; ix++) for (ix = 0; ix < n_bytes; ix++)
{
if (!*buf)
/* Oops, truncated */
break;
c1 = (c1 << 6) + (*buf++ & 0x3f); c1 = (c1 << 6) + (*buf++ & 0x3f);
}
n_bytes = ix;
} }
*c = c1; *c = c1;
return n_bytes+1; return n_bytes+1;

Loading…
Cancel
Save