]> granicus.if.org Git - php/commitdiff
Patch from the upstream git
authorRemi Collet <remi@php.net>
Tue, 30 May 2017 13:38:17 +0000 (15:38 +0200)
committerRemi Collet <remi@php.net>
Tue, 30 May 2017 13:38:17 +0000 (15:38 +0200)
https://github.com/kkos/oniguruma/issues/58 (CVE-2017-9227)

Thanks to Mamoru TASAKA <mtasaka@fedoraproject.org>

ext/mbstring/oniguruma/regexec.c

index 5e26896e365d8fc2adb4db23c8e71c809b6c0468..97d5f32d28d8a236efe68f13e8bdda106419496a 100644 (file)
@@ -3123,6 +3123,8 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
     }
     else {
       UChar *q = p + reg->dmin;
+
+      if (q >= end) return 0; /* fail */
       while (p < q) p += enclen(reg->enc, p);
     }
   }