From: M. J. T. Guy Date: Tue, 18 Jul 2000 11:30:16 +0000 (+0100) Subject: Protect against "wild next"s, that is, callbacks doing "next" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=73396e077e98f6642c85f22af0d45fb838622755;p=p5sagit%2Fp5-mst-13.2.git Protect against "wild next"s, that is, callbacks doing "next" instead of "return". Subject: [PATCH] Re: [ID 20000717.003] Core dump in 5.6.0 Message-Id: p4raw-id: //depot/perl@6423 --- diff --git a/lib/File/Find.pm b/lib/File/Find.pm index f803c15..a9f190c 100644 --- a/lib/File/Find.pm +++ b/lib/File/Find.pm @@ -373,7 +373,7 @@ sub _find_opt { $name = $abs_dir . $_; - &$wanted_callback; + { &$wanted_callback }; # protect against wild "next" } @@ -429,7 +429,7 @@ sub _find_dir($$$) { $_= ($no_chdir ? $dir_name : $dir_rel ); # prune may happen here $prune= 0; - &$wanted_callback; + { &$wanted_callback }; # protect against wild "next" next if $prune; } @@ -472,7 +472,7 @@ sub _find_dir($$$) { $name = $dir_pref . $FN; $_ = ($no_chdir ? $name : $FN); - &$wanted_callback; + { &$wanted_callback }; # protect against wild "next" } } @@ -496,13 +496,13 @@ sub _find_dir($$$) { else { $name = $dir_pref . $FN; $_= ($no_chdir ? $name : $FN); - &$wanted_callback; + { &$wanted_callback }; # protect against wild "next" } } else { $name = $dir_pref . $FN; $_= ($no_chdir ? $name : $FN); - &$wanted_callback; + { &$wanted_callback }; # protect against wild "next" } } } @@ -528,7 +528,7 @@ sub _find_dir($$$) { if ( substr($_,-2) eq '/.' ) { s|/\.$||; } - &$wanted_callback; + { &$wanted_callback }; # protect against wild "next" } else { push @Stack,[$CdLvl,$p_dir,$dir_rel,-1] if $bydepth; last; @@ -602,7 +602,7 @@ sub _find_dir_symlnk($$$) { # prune may happen here $prune= 0; lstat($_); # make sure file tests with '_' work - &$wanted_callback; + { &$wanted_callback }; # protect against wild "next" next if $prune; } @@ -652,7 +652,7 @@ sub _find_dir_symlnk($$$) { $fullname = $new_loc; $name = $dir_pref . $FN; $_ = ($no_chdir ? $name : $FN); - &$wanted_callback; + { &$wanted_callback }; # protect against wild "next" } } @@ -686,7 +686,7 @@ sub _find_dir_symlnk($$$) { } lstat($_); # make sure file tests with '_' work - &$wanted_callback; + { &$wanted_callback }; # protect against wild "next" } else { push @Stack,[$dir_loc, $pdir_loc, $p_dir, $dir_rel,-1] if $bydepth; last;