683572
From 12e1284a67e5e3404c704c3f864749fd9f04c7c4 Mon Sep 17 00:00:00 2001
683572
From: Tony Cook <tony@develop-help.com>
683572
Date: Wed, 7 Aug 2019 14:58:14 +1000
683572
Subject: [PATCH] PerlIO::Via: check arg is non-NULL before using it.
683572
MIME-Version: 1.0
683572
Content-Type: text/plain; charset=UTF-8
683572
Content-Transfer-Encoding: 8bit
683572
683572
I can't find any code in core that ends up calling the _pushed handler
683572
with arg == NULL, but PerlIO_push() is API, and there might be
683572
CPAN or DarkPAN code out there that does, escpecially since there's
683572
a check for arg being non-NULL further down.
683572
683572
CID 169261.
683572
683572
Signed-off-by: Petr Písař <ppisar@redhat.com>
683572
---
683572
 ext/PerlIO-via/via.xs | 4 ++--
683572
 1 file changed, 2 insertions(+), 2 deletions(-)
683572
683572
diff --git a/ext/PerlIO-via/via.xs b/ext/PerlIO-via/via.xs
683572
index d91c6855fc..8456242bc0 100644
683572
--- a/ext/PerlIO-via/via.xs
683572
+++ b/ext/PerlIO-via/via.xs
683572
@@ -134,8 +134,8 @@ PerlIOVia_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg,
683572
 {
683572
     IV code = PerlIOBase_pushed(aTHX_ f, mode, Nullsv, tab);
683572
 
683572
-    if (SvTYPE(arg) >= SVt_PVMG
683572
-		&& mg_findext(arg, PERL_MAGIC_ext, &PerlIOVia_tag)) {
683572
+    if (arg && SvTYPE(arg) >= SVt_PVMG
683572
+        && mg_findext(arg, PERL_MAGIC_ext, &PerlIOVia_tag)) {
683572
 	return code;
683572
     }
683572
 
683572
-- 
683572
2.21.0
683572