This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
longstanding bug in parsing "require VERSION", could reallocate
[perl5.git] / toke.c
diff --git a/toke.c b/toke.c
index 34599bd..44b3023 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -825,7 +825,7 @@ S_force_version(pTHX_ char *s)
        if (*d == 'v')
            d++;
         for (; isDIGIT(*d) || *d == '_' || *d == '.'; d++);
-        if ((*d == ';' || isSPACE(*d)) && *(skipspace(d)) != ',') {
+        if (*d == ';' || isSPACE(*d) || *d == '}' || !*d) {
             s = scan_num(s);
             /* real VERSION number -- GBARR */
             version = yylval.opval;