Skip to content

Commit 65a7878

Browse files
committed
RT#132875 DISTVNAME is a time bomb
This should ensure that given VERSION or VERSION_FROM is sane (for some value of sane). Passes t/parse_version.t anyways.
1 parent dda2b8b commit 65a7878

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/ExtUtils/MM_Unix.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,6 +3018,9 @@ sub parse_version {
30183018
my $normal = eval { version->new( $result ) };
30193019
$result = $normal if defined $normal;
30203020
}
3021+
if ( defined $result ) {
3022+
$result = "undef" unless $result =~ m!^[\d_\.\-]+$! or eval { version->parse( $result ) };
3023+
}
30213024
$result = "undef" unless defined $result;
30223025
return $result;
30233026
}

t/parse_version.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ my %versions = (q[$VERSION = '1.00'] => '1.00',
4444
'$VERSION = substr(q$Revision: 2.8 $, 10) + 2 . "";' => '4.8',
4545
q[our $VERSION = do { my @r = ( q$Revision: 2.7 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r };] => '2.07', # Fucking seriously?
4646
'elsif ( $Something::VERSION >= 1.99 )' => undef,
47-
47+
q[our $VERSION = "1.00 / the fucking fuck";] => 'undef',
4848
);
4949

5050
if( $Has_Version ) {

0 commit comments

Comments
 (0)