New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault in S_regmatch from bad backreference #13210
Comments
From andrewn@locus.netCreated by andrewn@locus.net$ ./perl -e '/\7777777777/' This is caused by a negative backreference in the compiled regex when the regcomp.c:10690: num = atoi(RExC_parse); This bug was discovered in our production system running perl-5.8.8-40.el5_9 The following patch does not properly correct the parsing of large integers, Inline Patchdiff --git a/regcomp.c b/regcomp.c
index 5a1e234..3854569 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -10688,6 +10688,9 @@ tryagain:
goto parse_named_seq;
} }
num = atoi(RExC_parse);
+ if(num < 0) {
+ vFAIL("Integer wrapped?");
+ }
if (isg && num == 0) {
if (*RExC_parse == '0') {
vFAIL("Reference to invalid group 0"); Perl Info
|
From @jkeenanOn Wed Aug 28 14:09:51 2013, andrewn@locus.net wrote:
Confirmed in blead. ##### At the very least, we would need to add a regression test before Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Wed, Aug 28, 2013 at 02:09:51PM -0700, andrewn@locus.net wrote:
Thanks for the report and patch. I've actually applied this more general commit 0c2990d [perl #119505] Segfault from bad backreference M regcomp.c -- |
@iabyn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#119505 (status was 'resolved')
Searchable as RT119505$
The text was updated successfully, but these errors were encountered: