summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pod/perldiag.pod5
-rw-r--r--t/run/switchC.t8
-rw-r--r--util.c3
3 files changed, 15 insertions, 1 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 51743733c1..803f3a04ae 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -2657,6 +2657,11 @@ provides a list context to its subscript, which can do weird things
if you're expecting only one subscript. When called in list context,
it also returns the key in addition to the value.
+=item Invalid number '%s' for -C option.
+
+(F) You supplied number to the -C option that either has extra leading
+zeroes or overflows perl's unsigned integer representation.
+
=item %s() is deprecated on :utf8 handles
(W deprecated) The sysread(), recv(), syswrite() and send() operators
diff --git a/t/run/switchC.t b/t/run/switchC.t
index 4f63c3b141..6583010551 100644
--- a/t/run/switchC.t
+++ b/t/run/switchC.t
@@ -11,7 +11,7 @@ BEGIN {
skip_all_if_miniperl('-C and $ENV{PERL_UNICODE} are disabled on miniperl');
}
-plan(tests => 14);
+plan(tests => 15);
my $r;
@@ -111,3 +111,9 @@ SKIP: {
like( $r, qr/^Too late for "-CS" option at -e line 1\.$/s,
'#!perl -C but not command line' );
}
+
+$r = runperl ( switches => [ '-C00' ],
+ prog => '1',
+ stderr => 1, );
+like($r, qr/^Invalid number '00' for -C option\.$/s,
+ "perl -C00 [perl #123991]");
diff --git a/util.c b/util.c
index aeec4c08c7..17b62dda76 100644
--- a/util.c
+++ b/util.c
@@ -4538,6 +4538,9 @@ Perl_parse_unicode_opts(pTHX_ const char **popt)
Perl_croak(aTHX_ "Unknown Unicode option letter '%c'", *p);
}
}
+ else {
+ Perl_croak(aTHX_ "Invalid number '%s' for -C option.\n", p);
+ }
}
else {
for (; *p; p++) {