forked from github/server
CID 182685 check for utf8 encoding errors.
This commit is contained in:
parent
8a74ac81e0
commit
0884fb1f1b
1 changed files with 7 additions and 2 deletions
|
@ -178,9 +178,14 @@ static int count_umlaut(const char *s)
|
||||||
ucs4_t ucs = *cp;
|
ucs4_t ucs = *cp;
|
||||||
if (ucs & 0x80) {
|
if (ucs & 0x80) {
|
||||||
size_t size;
|
size_t size;
|
||||||
++result;
|
int err;
|
||||||
unicode_utf8_to_ucs4(&ucs, cp, &size);
|
err = unicode_utf8_to_ucs4(&ucs, cp, &size);
|
||||||
|
if (err != 0) {
|
||||||
|
log_error("illegal utf8 encoding %s at %s", s, cp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
cp += size;
|
cp += size;
|
||||||
|
++result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue