From 3bf38418777094bb685265138234ab6e04aa1d90 Mon Sep 17 00:00:00 2001 From: Wolfgang Laun Date: Mon, 26 Nov 2001 20:56:32 +0100 Subject: [PATCH] unpack P* uses random length for item Message-ID: <200111261956320450.01E7217F@smtp.chello.at> p4raw-id: //depot/perl@13288 --- pod/perldiag.pod | 4 ++++ pp_pack.c | 2 ++ t/op/pack.t | 11 ++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pod/perldiag.pod b/pod/perldiag.pod index aab7831..34be258 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2711,6 +2711,10 @@ value of the environment variable PERLIO. process which isn't a subprocess of the current process. While this is fine from VMS' perspective, it's probably not what you intended. +=item P must have an explicit size + +(F) The unpack format P must have an explicit size, not "*". + =item POSIX syntax [%s] belongs inside character classes in regex; marked by <-- HERE in m/%s/ diff --git a/pp_pack.c b/pp_pack.c index 705ee12..ceb01c5 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -922,6 +922,8 @@ PP(pp_unpack) } break; case 'P': + if (star) + DIE(aTHX_ "P must have an explicit size"); EXTEND(SP, 1); if (sizeof(char*) > strend - s) break; diff --git a/t/op/pack.t b/t/op/pack.t index 5107510..bb63cff 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -1,6 +1,6 @@ #!./perl -w -print "1..614\n"; +print "1..615\n"; BEGIN { chdir 't' if -d 't'; @@ -695,3 +695,12 @@ foreach ( $s eq "ABCABCABCABCABCABCABCABCABCABC" & $y == 42); } + +{ + # 615 + + # from Wolfgang Laun:Lfix in change #13288 + + eval { unpack("P*", "abc") }; + ok($@ =~ /P must have an explicit size/); +} -- 1.8.3.1