This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revise check for negative versions plus test
[perl5.git] / util.c
diff --git a/util.c b/util.c
index fcfeda9..e22a97f 100644 (file)
--- a/util.c
+++ b/util.c
@@ -4541,6 +4541,11 @@ dotted_decimal_version:
            }
        }
 
+       /* and we never support negative versions */
+       if ( *d == '-') {
+               BADVERSION(s,errstr,"Invalid version format (negative version number)");                
+       }
+
        /* consume all of the integer part */
        while (isDIGIT(*d))
            d++;
@@ -4559,9 +4564,6 @@ dotted_decimal_version:
            /* found just an integer */
            goto version_prescan_finish;
        }
-       else if ( *d == '-') {
-               BADVERSION(s,errstr,"Invalid version format (negative version number)");                
-       }
        else if ( d == s ) {
            /* didn't find either integer or period */
            BADVERSION(s,errstr,"Invalid version format (non-numeric data)");