This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix [perl #74542] 5.12.0 crash on diverse platforms
authorRafael Garcia-Suarez <rgs@consttype.org>
Wed, 21 Apr 2010 13:47:36 +0000 (15:47 +0200)
committerRafael Garcia-Suarez <rgs@consttype.org>
Wed, 21 Apr 2010 13:47:36 +0000 (15:47 +0200)
Filetest ops don't always expect an op on the stack, so we should use
TOPs only if we're sure that we're not stat'ing the _ filehandle.
This is indicated by OPf_KIDS (as checked in ck_ftst).

pp.h

diff --git a/pp.h b/pp.h
index 9d078af..c36502a 100644 (file)
--- a/pp.h
+++ b/pp.h
@@ -474,7 +474,8 @@ Does not use C<TARG>.  See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>.
 #define tryAMAGICftest(chr)                            \
     STMT_START {                                       \
        assert(chr != '?');                             \
-       if (SvAMAGIC(TOPs)) {                           \
+       if ((PL_op->op_flags & OPf_KIDS)                \
+               && SvAMAGIC(TOPs)) {                    \
            const char tmpchr = (chr);                  \
            SV * const tmpsv = amagic_call(TOPs,        \
                newSVpvn_flags(&tmpchr, 1, SVs_TEMP),   \