This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #41560] [PATCH] crash in Perl_vmess when GvIOp is null
authorDevin Heitmueller <devin.heitmueller@gmail.com>
Tue, 20 Feb 2007 16:38:20 +0000 (08:38 -0800)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sun, 25 Feb 2007 16:44:52 +0000 (16:44 +0000)
From: "Devin Heitmueller" (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-24617-1172018300-131.41560-75-0@perl.org>

p4raw-id: //depot/perl@30398

util.c

diff --git a/util.c b/util.c
index 3c55183..c2870ea 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1154,7 +1154,10 @@ Perl_vmess(pTHX_ const char *pat, va_list *args)
        if (CopLINE(cop))
            Perl_sv_catpvf(aTHX_ sv, " at %s line %"IVdf,
            OutCopFILE(cop), (IV)CopLINE(cop));
-       if (GvIO(PL_last_in_gv) && IoLINES(GvIOp(PL_last_in_gv))) {
+       /* Seems that GvIO() can be untrustworthy during global destruction. */
+       if (GvIO(PL_last_in_gv) && (SvTYPE(GvIOp(PL_last_in_gv)) == SVt_PVIO)
+               && IoLINES(GvIOp(PL_last_in_gv)))
+       {
            const bool line_mode = (RsSIMPLE(PL_rs) &&
                              SvCUR(PL_rs) == 1 && *SvPVX_const(PL_rs) == '\n');
            Perl_sv_catpvf(aTHX_ sv, ", <%s> %s %"IVdf,