avoid passing large backreference numbers back as negative numbers blead tonyc/grokfix
authorTony Cook <tony@develop-help.com>
Mon, 28 Jul 2014 06:40:49 +0000 (16:40 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 28 Jul 2014 06:40:49 +0000 (16:40 +1000)
regcomp.c

index 24fb0a7..8075010 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -11164,10 +11164,10 @@ static I32
 S_backref_value(char *p)
 {
     const char* endptr;
-    Size_t val = grok_atou(p, &endptr);
-    if (endptr == p || endptr == NULL || val > 999999999)
+    UV val = grok_atou(p, &endptr);
+    if (endptr == p || endptr == NULL || val > I32_MAX)
         return I32_MAX;
-    return val;
+    return (I32)val;
 }