Skip to content

Commit d1fbc98

Browse files
committed
Sync fix for bug #72910 with current upstream
1 parent b7259b7 commit d1fbc98

File tree

1 file changed

+5
-3
lines changed
  • ext/mbstring/oniguruma/enc

1 file changed

+5
-3
lines changed

ext/mbstring/oniguruma/enc/utf8.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,16 @@ is_mbc_newline(const UChar* p, const UChar* end)
9191
}
9292

9393
static OnigCodePoint
94-
mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
94+
mbc_to_code(const UChar* p, const UChar* end)
9595
{
9696
int c, len;
9797
OnigCodePoint n;
9898

99-
len = enclen(ONIG_ENCODING_UTF8, p);
99+
len = mbc_enc_len(p);
100+
if (len > end - p) len = end - p;
101+
100102
c = *p++;
101-
if (len > 1 && p < end) {
103+
if (len > 1) {
102104
len--;
103105
n = c & ((1 << (6 - len)) - 1);
104106
while (len--) {

0 commit comments

Comments
 (0)