1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
Backported from 5.6.26 by Remi.
From 486056b2153f7177cd8a7c78d93968726ee8fa65 Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev <stas@php.net>
Date: Thu, 1 Sep 2016 23:27:06 -0700
Subject: [PATCH] Fix bug #72910
Merge upstream patch from https://github.com/kkos/oniguruma/commit/65bdf2a0d160d06556415e5f396a75f6b11bad5c
---
ext/mbstring/oniguruma/enc/utf8.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/mbstring/oniguruma/enc/utf8.c b/ext/mbstring/oniguruma/enc/utf8.c
index 5e2c172..74122e1 100644
--- a/ext/mbstring/oniguruma/enc/utf8.c
+++ b/ext/mbstring/oniguruma/enc/utf8.c
@@ -98,7 +98,7 @@ mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
len = enclen(ONIG_ENCODING_UTF8, p);
c = *p++;
- if (len > 1) {
+ if (len > 1 && p < end) {
len--;
n = c & ((1 << (6 - len)) - 1);
while (len--) {
From b570c506815212c7702bfb0046e87d541e171eb7 Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev <stas@php.net>
Date: Sun, 4 Sep 2016 19:13:22 -0700
Subject: [PATCH] Sync fix for bug #72910 with current upstream
---
ext/mbstring/oniguruma/enc/utf8.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ext/mbstring/oniguruma/enc/utf8.c b/ext/mbstring/oniguruma/enc/utf8.c
index 74122e1..9e8478f 100644
--- a/ext/mbstring/oniguruma/enc/utf8.c
+++ b/ext/mbstring/oniguruma/enc/utf8.c
@@ -91,14 +91,16 @@ is_mbc_newline(const UChar* p, const UChar* end)
}
static OnigCodePoint
-mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
+mbc_to_code(const UChar* p, const UChar* end)
{
int c, len;
OnigCodePoint n;
- len = enclen(ONIG_ENCODING_UTF8, p);
+ len = mbc_enc_len(p);
+ if (len > end - p) len = end - p;
+
c = *p++;
- if (len > 1 && p < end) {
+ if (len > 1) {
len--;
n = c & ((1 << (6 - len)) - 1);
while (len--) {
|