This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid a pad panic by attempting to use dTARGET; in an op that didn't
authorNicholas Clark <nick@ccl4.org>
Wed, 2 Nov 2005 17:24:35 +0000 (17:24 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 2 Nov 2005 17:24:35 +0000 (17:24 +0000)
flag that it needed a target (OP_FTIS)

p4raw-id: //depot/perl@25960

pp_sys.c

index 3f0a25b..98c7348 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3046,17 +3046,20 @@ PP(pp_fteexec)
 PP(pp_ftis)
 {
     I32 result;
+    const int op_type = PL_op->op_type;
     dSP;
     STACKED_FTEST_CHECK;
     result = my_stat();
     SPAGAIN;
     if (result < 0)
        RETPUSHUNDEF;
+    if (op_type == OP_FTIS)
+       RETPUSHYES;
     {
+       /* You can't dTARGET inside OP_FTIS, because you'll get
+          "panic: pad_sv po" - the op is not flagged to have a target.  */
        dTARGET;
-       switch (PL_op->op_type) {
-       case OP_FTIS:
-           RETPUSHYES;
+       switch (op_type) {
        case OP_FTSIZE:
 #if Off_t_size > IVSIZE
            PUSHn(PL_statcache.st_size);