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
Special var @- becomes arbitrarily large #7934
Comments
From daoswald@adelphia.netThe following code will result in @- becoming an arbitrarily large use strict; my $string = "abc"; while( $string =~ /b/g ) { And the output... 22350300 This is under ActivePerl 5.8.6 on Win32. The problem has been http://www.perlmonks.org/?node_id=461653 As others in that thread have pointed out, the number "22350300" is If this bug turns up in the context of: print "@-\n"; instead of print "$#-\n"; ...the result will lead to a script grinding to a halt, or worse, Dave |
daoswald@adelphia.net - Status changed from 'new' to 'open' |
daoswald@adelphia.net - Status changed from 'open' to 'new' |
From daoswald@adelphia.netUpdate: Perl 5.8.7 exhibits the same errant behavior. |
@demerphq - Status changed from 'new' to 'open' |
From @demerphqI believe this bug is fixed in the development version of perl, however Attached is a test patch, and on the assumption it will be applied, I Thanks for the report. |
From @demerphqop_pat_t.patch---------[STARTPATCH]---------
d:\dev\util\diffnew.pl -u -W 29177/t/op/pat.t 29177_/t/op/pat.t
--- 29177/t/op/pat.t Mon Oct 16 13:57:08 2006
+++ 29177_/t/op/pat.t Wed Nov 1 11:22:38 2006
@@ -3839,6 +3839,17 @@
ok(eval("qq/$targ/ =~ /$reg/"), "\\c\\ in pattern");
}
+{
+ my $str='abc';
+ my $count=0;
+ my $mval=0;
+ my $pval=0;
+ while ($str=~/b/g) { $mval=$#-; $pval=$#+; $count++ }
+ iseq($mval,0,"\@- should be empty [RT#36046]");
+ iseq($pval,0,"\@+ should be empty [RT#36046]");
+ iseq($count,1,"should have matched once only [RT#36046]");
+}
+
# Keep the following tests last -- they may crash perl
ok(("a" x (2**15 - 10)) =~ /^()(a|bb)*$/, "Recursive stack cracker: #24274")
@@ -3849,5 +3860,5 @@
or print "# Unexpected outcome: should pass or crash perl\n";
# Don't forget to update this!
-BEGIN{print "1..1284\n"};
+BEGIN{print "1..1287\n"};
d:\dev\util\diffnew.pl -u -W 29177/win32/Makefile 29177_/win32/Makefile
---------[ENDPATCH]---------
|
@demerphq - Status changed from 'open' to 'resolved' |
From @rgarciaOn 01/11/06, yves orton via RT <perlbug-followup@perl.org> wrote:
Thanks, applied. |
Migrated from rt.perl.org#36046 (status was 'resolved')
Searchable as RT36046$
The text was updated successfully, but these errors were encountered: