diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-07-03 14:26:13 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-07-03 14:26:13 +0000 |
commit | ead4c2def6106b143846c6de0179fa3e6af2845f (patch) | |
tree | 4fd9f5b32507e8ddf028475890616c988cbd4050 | |
parent | b3affbb58a452a300f9da5f19ca962168d4c66d4 (diff) | |
download | perl-ead4c2def6106b143846c6de0179fa3e6af2845f.tar.gz |
Forbid \g0. (tests coming later)
p4raw-id: //depot/perl@31524
-rw-r--r-- | pod/perldiag.pod | 7 | ||||
-rw-r--r-- | regcomp.c | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index d0cedfc28a..338fd12da6 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -3556,6 +3556,13 @@ Doing so has no effect. (W internal) The internal sv_replace() function was handed a new SV with a reference count of other than 1. +=item Reference to invalid group 0 + +(F) You used C<\g0> or similar in a regular expression. You may refer to +capturing parentheses only with strictly positive integers (normal +backreferences) or with stricly negative integers (relative +backreferences), but using 0 does not make sense. + =item Reference to nonexistent group in regex; marked by <-- HERE in m/%s/ (F) You used something like C<\7> in your regular expression, but there are @@ -7052,6 +7052,8 @@ tryagain: goto parse_named_seq; } } num = atoi(RExC_parse); + if (isg && num == 0) + vFAIL("Reference to invalid group 0"); if (isrel) { num = RExC_npar - num; if (num < 1) |