From: | gregoa [...] cpan.org |
Subject: | libemail-mime-perl: use of uninitialized values in Encode.pm and Header.pm |
This bug has been forwarded from http://bugs.debian.org/733317
-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->
Package: libemail-mime-perl
Version: 1.925-1
Severity: normal
I see frequently this:
Use of uninitialized value $header in pattern match (m//) at /usr/share/perl5/Email/MIME/Header.pm line 19
Use of uninitialized value $val in pattern match (m//) at /usr/share/perl5/Email/MIME/Encode.pm line 31
I can easily reproduce the "Encode.pm line 31". The warning shows up
on headers similar to this:
To: foo@example.org, =?Windows-1252?Q?G=F6ran_Haraldsson?= <goran.haraldsson@example.org>
but not on this:
To: foo <foo@example.org>, =?Windows-1252?Q?G=F6ran_Haraldsson?= <goran.haraldsson@example.org>
^^^^^ ^
I can produce a simple example code, if needed. Still, this patch:
--- Encode.pm.orig 2013-11-08 13:01:07.000000000 +0100
+++ Encode.pm 2013-12-28 13:33:37.083303204 +0100
@@ -28,8 +28,8 @@
sub maybe_mime_encode_header {
my ($header, $val, $charset) = @_;
- return $val unless $val =~ /\P{ASCII}/
- || $val =~ /=\?/;
+ return $val unless $val &&
+ ($val =~ /\P{ASCII}/ || $val =~ /=\?/);
$header =~ s/^Resent-//;
@@ -56,10 +56,10 @@
@addrs = map {
my $phrase = $_->phrase;
$_->phrase(mime_encode($phrase, $charset))
- if $phrase =~ /\P{ASCII}/;
+ if $phrase && $phrase =~ /\P{ASCII}/;
my $comment = $_->comment;
$_->comment(mime_encode($comment, $charset))
- if $comment =~ /\P{ASCII}/;
+ if $comment && $comment =~ /\P{ASCII}/;
$_;
} @addrs;
---
removes some Encode.pm warnings. I suspect the Header.pm warning has a
similar cause. What about this patch:
--- Header.pm.orig 2013-11-08 13:01:07.000000000 +0100
+++ Header.pm 2013-12-28 13:51:49.000000000 +0100
@@ -16,7 +16,7 @@
my @header = $self->SUPER::header(@_);
local $@;
foreach my $header (@header) {
- next unless $header =~ /=\?/;
+ next unless $header && $header =~ /=\?/;
$header = $self->_header_decode_str($header);
}
return wantarray ? (@header) : $header[0];
---
-- System Information:
Debian Release: jessie/sid
APT prefers testing
APT policy: (500, 'testing'), (99, 'unstable'), (59, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=, LC_CTYPE= (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Versions of packages libemail-mime-perl depends on:
ii libemail-address-perl 1.900-1
ii libemail-messageid-perl 1.402-1
ii libemail-mime-contenttype-perl 1.017-1
ii libemail-mime-encodings-perl 1.315-1
ii libemail-simple-perl 2.201-1
ii libmime-types-perl 2.04-1
ii perl 5.18.1-5
libemail-mime-perl recommends no packages.
libemail-mime-perl suggests no packages.
-- no debconf information
Cheers,
--
Cristian
<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
Thanks in advance,
gregor herrmann, Debian Perl Group