re_intuit_start(): always initialise start_shift
authorDavid Mitchell <davem@iabyn.com>
Sat, 8 Mar 2014 14:38:56 +0000 (14:38 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sun, 16 Mar 2014 18:03:50 +0000 (18:03 +0000)
The start_shift variable is usually initialised to prog->check_offset_min,
except for one code path where it is left at zero. It turns out that
in that code path, the value isn't (currently) used, so is safe. However,
that may change, so unconditionally initialise it.

regexec.c

index 123d484..48e0fcc 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -635,7 +635,7 @@ Perl_re_intuit_start(pTHX_
 {
     dVAR;
     struct regexp *const prog = ReANY(rx);
-    SSize_t start_shift = 0;
+    SSize_t start_shift = prog->check_offset_min;
     /* Should be nonnegative! */
     SSize_t end_shift   = 0;
     /* current lowest pos in string where the regex can start matching */
@@ -805,7 +805,6 @@ Perl_re_intuit_start(pTHX_
        }
     }
 
-    start_shift = prog->check_offset_min;  /* okay to underestimate on CC */
     end_shift = prog->check_end_shift;
 
 #ifdef DEBUGGING       /* 7/99: reports of failure (with the older version) */