Skip to content

Instantly share code, notes, and snippets.

@hughdavenport
Created December 29, 2018 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hughdavenport/89849d35cc27c2242edcce4eb7c93520 to your computer and use it in GitHub Desktop.
Save hughdavenport/89849d35cc27c2242edcce4eb7c93520 to your computer and use it in GitHub Desktop.
diff --git a/ext/mbstring/oniguruma/regcomp.c b/ext/mbstring/oniguruma/regcomp.c
index b93ca948a7..a0057872b1 100644
--- a/ext/mbstring/oniguruma/regcomp.c
+++ b/ext/mbstring/oniguruma/regcomp.c
@@ -524,6 +524,7 @@ compile_string_node(Node* node, regex_t* reg)
for (; p < end; ) {
len = enclen(enc, p);
+ if (p + len > end) len = end - p;
if (len == prev_len) {
slen++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment