56157f3
From fbe6adf2e4213395a34c891a7568c6e3c7812645 Mon Sep 17 00:00:00 2001
56157f3
From: Yves Orton <demerphq@gmail.com>
56157f3
Date: Thu, 6 Feb 2020 07:11:20 +0100
56157f3
Subject: [PATCH] B::Deparse fixup uninitialized error in deparsing weird glob
56157f3
 statement
56157f3
MIME-Version: 1.0
56157f3
Content-Type: text/plain; charset=UTF-8
56157f3
Content-Transfer-Encoding: 8bit
56157f3
56157f3
This fixes issue #17537, and adds tests
56157f3
56157f3
Signed-off-by: Petr Písař <ppisar@redhat.com>
56157f3
---
56157f3
 lib/B/Deparse.pm |  2 +-
56157f3
 lib/B/Deparse.t  | 15 +++++++++++++++
56157f3
 2 files changed, 16 insertions(+), 1 deletion(-)
56157f3
56157f3
diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm
56157f3
index ee126b1552..aa6e6de4e4 100644
56157f3
--- a/lib/B/Deparse.pm
56157f3
+++ b/lib/B/Deparse.pm
56157f3
@@ -3393,7 +3393,7 @@ sub pp_glob {
56157f3
     my $kid = $op->first->sibling;  # skip pushmark
56157f3
     my $keyword =
56157f3
 	$op->flags & OPf_SPECIAL ? 'glob' : $self->keyword('glob');
56157f3
-    my $text = $self->deparse($kid);
56157f3
+    my $text = $self->deparse($kid, $cx);
56157f3
     return $cx >= 5 || $self->{'parens'}
56157f3
 	? "$keyword($text)"
56157f3
 	: "$keyword $text";
56157f3
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t
56157f3
index 07c915067e..e06ef6e966 100644
56157f3
--- a/lib/B/Deparse.t
56157f3
+++ b/lib/B/Deparse.t
56157f3
@@ -20,6 +20,8 @@ my $deparse = B::Deparse->new();
56157f3
 isa_ok($deparse, 'B::Deparse', 'instantiate a B::Deparse object');
56157f3
 my %deparse;
56157f3
 
56157f3
+sub dummy_sub {42}
56157f3
+
56157f3
 $/ = "\n####\n";
56157f3
 while (<DATA>) {
56157f3
     chomp;
56157f3
@@ -679,6 +681,19 @@ readline $foo;
56157f3
 glob $foo;
56157f3
 glob $foo;
56157f3
 ####
56157f3
+# more <>
56157f3
+no warnings;
56157f3
+no strict;
56157f3
+my $fh;
56157f3
+if (dummy_sub < $fh > /bar/g) { 1 }
56157f3
+>>>>
56157f3
+no warnings;
56157f3
+no strict;
56157f3
+my $fh;
56157f3
+if (dummy_sub(glob((' ' . $fh . ' ')) / 'bar' / 'g')) {
56157f3
+    1;
56157f3
+}
56157f3
+####
56157f3
 # readline
56157f3
 readline 'FH';
56157f3
 readline *$_;
56157f3
-- 
56157f3
2.21.1
56157f3