We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7259b7 commit d1fbc98Copy full SHA for d1fbc98
ext/mbstring/oniguruma/enc/utf8.c
@@ -91,14 +91,16 @@ is_mbc_newline(const UChar* p, const UChar* end)
91
}
92
93
static OnigCodePoint
94
-mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
+mbc_to_code(const UChar* p, const UChar* end)
95
{
96
int c, len;
97
OnigCodePoint n;
98
99
- len = enclen(ONIG_ENCODING_UTF8, p);
+ len = mbc_enc_len(p);
100
+ if (len > end - p) len = end - p;
101
+
102
c = *p++;
- if (len > 1 && p < end) {
103
+ if (len > 1) {
104
len--;
105
n = c & ((1 << (6 - len)) - 1);
106
while (len--) {
0 commit comments