]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fixed use of uninitialized value
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 1 Jul 2021 13:21:19 +0000 (06:21 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 1 Jul 2021 13:21:19 +0000 (06:21 -0700)
lib/Perl/Tidy/Tokenizer.pm
local-docs/BugLog.pod

index 2ab93c13b23140ff5eb87bb7270100542eebe6ba..b0e3676d90d88a8660238518b73c6358bdc9013a 100644 (file)
@@ -7584,10 +7584,13 @@ sub find_next_nonblank_token {
               peek_ahead_for_nonblank_token( $rtokens, $max_token_index );
         }
     }
+
     my $next_nonblank_token = $rtokens->[ ++$i ];
+    return ( " ", $i ) unless defined($next_nonblank_token);
 
     if ( $next_nonblank_token =~ /^\s*$/ ) {
         $next_nonblank_token = $rtokens->[ ++$i ];
+        return ( " ", $i ) unless defined($next_nonblank_token);
     }
     return ( $next_nonblank_token, $i );
 }
index 35a916e03a2d67532272cffa8e5b554ed379ba32..8cc0484c2e058da05b80fdafd45e76740a8d6976 100644 (file)
@@ -2,6 +2,16 @@
 
 =over 4
 
+=item B<Fixed use of uninitialized value>
+
+The previous Tokenizer update caused the use of an unitialized value when run on case b1053:
+
+ Use of uninitialized value $next_nonblank_token in pattern match (m//) at /home/steve/bin/Perl/Tidy/Tokenizer.pm line 7589.
+ Use of uninitialized value $nn_nonblank_token in pattern match (m//) at /home/steve/bin/Perl/Tidy/Tokenizer.pm line 3723.
+ b1053 converged on iteration 2
+
+This update fixes this.
+
 =item B<Fix token type of colon introducing anonomyous sub attribute list>
 
 In the following example