Skip to content

Commit 27a743b

Browse files
committed
Patch from the upstream git
kkos/oniguruma#59 (CVE-2017-9229) b690371bbf97794b4a1d3f295d4fb9a8b05d402d Modified for onig 5.9.6 Thanks to Mamoru TASAKA <mtasaka@fedoraproject.org>
1 parent bdf7393 commit 27a743b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ext/mbstring/oniguruma/regexec.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3205,7 +3205,13 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
32053205
else {
32063206
if (reg->dmax != ONIG_INFINITE_DISTANCE) {
32073207
*low = p - reg->dmax;
3208-
if (*low > s) {
3208+
if (p - str < reg->dmax) {
3209+
*low = (UChar* )str;
3210+
if (low_prev)
3211+
*low_prev = onigenc_get_prev_char_head(reg->enc, str, *low);
3212+
}
3213+
else {
3214+
if (*low > s) {
32093215
*low = onigenc_get_right_adjust_char_head_with_prev(reg->enc, s,
32103216
*low, (const UChar** )low_prev);
32113217
if (low_prev && IS_NULL(*low_prev))
@@ -3218,6 +3224,7 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
32183224
(pprev ? pprev : str), *low);
32193225
}
32203226
}
3227+
}
32213228
}
32223229
/* no needs to adjust *high, *high is used as range check only */
32233230
*high = p - reg->dmin;

0 commit comments

Comments
 (0)