perl/SOURCES/perl-5.31.2-PerlIO-Via-check-arg-is-non-NULL-before-using-it.patch

39 lines
1.2 KiB
Diff
Raw Normal View History

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