Fix a syntax error in test
[p5sagit/p5-mst-13.2.git] / regexec.c
index 94ad06f..0f5d6fb 100644 (file)
--- a/regexec.c
+++ b/regexec.c
     : (U8*)NULL)                       \
 )
 
-#define reghopmaybe3_c(pos,off,lim) ((char*)reghopmaybe3((U8*)pos, off, (U8*)lim))
 #define HOP3(pos,off,lim) (PL_reg_match_utf8 ? reghop3((U8*)pos, off, (U8*)lim) : (U8*)(pos + off))
 #define HOP3c(pos,off,lim) ((char*)HOP3(pos,off,lim))
 
@@ -572,7 +571,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
                t = s - prog->check_offset_max;
                if (s - strpos > prog->check_offset_max  /* signed-corrected t > strpos */
                    && (!do_utf8
-                       || ((t = reghopmaybe3_c(s, -(prog->check_offset_max), strpos))
+                       || ((t = (char*)reghopmaybe3((U8*)s, -(prog->check_offset_max), (U8*)strpos))
                            && t > strpos)))
                    NOOP;
                else
@@ -692,7 +691,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
     t = s - prog->check_offset_max;
     if (s - strpos > prog->check_offset_max  /* signed-corrected t > strpos */
         && (!do_utf8
-           || ((t = reghopmaybe3_c(s, -prog->check_offset_max, strpos))
+           || ((t = (char*)reghopmaybe3((U8*)s, -prog->check_offset_max, (U8*)strpos))
                 && t > strpos))) {
        /* Fixed substring is found far enough so that the match
           cannot start at strpos. */
@@ -3653,6 +3652,9 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog)
                        *that* much linear. */
                if (!PL_reg_maxiter) {
                    PL_reg_maxiter = (PL_regeol - PL_bostr + 1) * (scan->flags>>4);
+                   /* possible overflow for long strings and many CURLYX's */
+                   if (PL_reg_maxiter < 0)
+                       PL_reg_maxiter = I32_MAX;
                    PL_reg_leftiter = PL_reg_maxiter;
                }
                if (PL_reg_leftiter-- == 0) {
@@ -5102,7 +5104,7 @@ S_reginclass(pTHX_ const regexp *prog, register const regnode *n, register const
 }
 
 STATIC U8 *
-S_reghop3(U8 *s, I32 off, U8* lim)
+S_reghop3(U8 *s, I32 off, const U8* lim)
 {
     dVAR;
     if (off >= 0) {
@@ -5127,7 +5129,7 @@ S_reghop3(U8 *s, I32 off, U8* lim)
 }
 
 STATIC U8 *
-S_reghopmaybe3(U8* s, I32 off, U8* lim)
+S_reghopmaybe3(U8* s, I32 off, const U8* lim)
 {
     dVAR;
     if (off >= 0) {