Fix bug of n in function of ngx_utf8_length
liu yunbin
yunbinliu at outlook.com
Wed Apr 10 19:56:26 UTC 2019
# HG changeset patch
# User Yunbin Liu yunbinliu at outlook.com
# Date 1554925873 -28800
# Thu Apr 11 03:51:13 2019 +0800
# Node ID 228b945cf5f8c30356fc5760f696e49545075f00
# Parent a6e23e343081b79eb924da985a414909310aa7a3
Fix bug of n in function of ngx_utf8_length
diff -r a6e23e343081 -r 228b945cf5f8 src/core/ngx_string.c
--- a/src/core/ngx_string.c Tue Apr 09 16:00:30 2019 +0300
+++ b/src/core/ngx_string.c Thu Apr 11 03:51:13 2019 +0800
@@ -1369,6 +1369,7 @@
{
u_char c, *last;
size_t len;
+ u_char *current_point;
last = p + n;
@@ -1378,13 +1379,16 @@
if (c < 0x80) {
p++;
+ n--;
continue;
}
+ current_point = p;
if (ngx_utf8_decode(&p, n) > 0x10ffff) {
/* invalid UTF-8 */
return n;
}
+ n -= p - current_point;
}
return len;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20190410/ec7ace7f/attachment.html>
More information about the nginx
mailing list