This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH [perl #132164] regcomp.c: Don't try to increment infinity
authorKarl Williamson <khw@cpan.org>
Sun, 1 Apr 2018 19:58:47 +0000 (13:58 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 17 Apr 2018 19:01:50 +0000 (13:01 -0600)
This value can be infinity (which is here SSize_t_MAX).  Leave it there.

regcomp.c
t/re/pat.t

index d37f2d1..11899ee 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -5476,7 +5476,9 @@ Perl_re_printf( aTHX_  "LHS=%" UVuf " RHS=%" UVuf "\n",
                 /* Cannot expect anything... */
                 scan_commit(pRExC_state, data, minlenp, is_inf);
                data->pos_min += 1;
                 /* Cannot expect anything... */
                 scan_commit(pRExC_state, data, minlenp, is_inf);
                data->pos_min += 1;
-               data->pos_delta += 1;
+                if (data->pos_delta != SSize_t_MAX) {
+                    data->pos_delta += 1;
+                }
                data->cur_is_floating = 1; /* float */
            }
        }
                data->cur_is_floating = 1; /* float */
            }
        }
index 066ac96..82206df 100644 (file)
@@ -23,7 +23,7 @@ BEGIN {
     skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader;
     skip_all_without_unicode_tables();
 
     skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader;
     skip_all_without_unicode_tables();
 
-plan tests => 847;  # Update this when adding/deleting tests.
+plan tests => 848;  # Update this when adding/deleting tests.
 
 run_tests() unless caller;
 
 
 run_tests() unless caller;
 
@@ -1943,6 +1943,9 @@ EOP
     {   # [perl $132227]
         fresh_perl_is("('0ba' . ('ss' x 300)) =~ m/0B\\N{U+41}" . $sharp_s x 150 . '/i and print "1\n"',  1,{},"Use of sharp s under /di that changes to /ui");
     }
     {   # [perl $132227]
         fresh_perl_is("('0ba' . ('ss' x 300)) =~ m/0B\\N{U+41}" . $sharp_s x 150 . '/i and print "1\n"',  1,{},"Use of sharp s under /di that changes to /ui");
     }
+    {   # [perl $132164]
+        fresh_perl_is('m m0*0+\Rm', "",{},"Undefined behavior in address sanitizer");
+    }
 
 } # End of sub run_tests
 
 
 } # End of sub run_tests