This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Fix wrong limit test
authorKarl Williamson <khw@cpan.org>
Thu, 22 Aug 2019 16:16:14 +0000 (10:16 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 22 Aug 2019 16:20:33 +0000 (10:20 -0600)
Spotted by Hugo van der Sanden in code reading.

regcomp.c

index aba6648..d61fd43 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -23132,7 +23132,7 @@ Perl_parse_uniprop_string(pTHX_
 
     /* If the original input began with 'In' or 'Is', it could be a subroutine
      * call to a user-defined property instead of a Unicode property name. */
-    if (    non_pkg_begin + name_len > 2
+    if (    name_len - non_pkg_begin > 2
         &&  name[non_pkg_begin+0] == 'I'
         && (name[non_pkg_begin+1] == 'n' || name[non_pkg_begin+1] == 's'))
     {