Bug#958194: libtext-vcard-perl: address_book->load_string() dies on missing name

Celejar celejar at gmail.com
Sun Apr 19 15:44:53 BST 2020


Package: libtext-vcard-perl
Version: 3.09-1
Severity: normal

While writing an Android contacts -> VCF converter, I discovered that
the vCard::Addressbook "load_string" method dies when called on a vCard
(created using standard Perl vCard methods) that is missing name data.
The following script demonstrates the problem:

#! /usr/bin/perl -w

use vCard;
use strict;

my $vcard = vCard->new;
$vcard->phones([{type => ['home'], number => '651-290-1111'}]);
my $address_book = vCard::AddressBook->new();
$address_book->load_string($vcard->as_string);

This dies with the error:

Can't call method "family" on an undefined value at /usr/share/perl5/vCard/AddressBook.pm line 208.

I understand that such a vCard may violate RFC 6350:

https://tools.ietf.org/html/rfc6350

(and may not be all that useful anyway), but in my opinion, the module
should handle this case better, rather than force the programmer to
write eval or try / catch semantics, or to figure out some way to verify
the vCard's correctness before calling "load_string".

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.5.0-1-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libtext-vcard-perl depends on:
ii  libmoo-perl                2.004000-1
ii  libpath-tiny-perl          0.108-1
ii  libtext-vfile-asdata-perl  0.08-1
ii  libunicode-linebreak-perl  0.0.20190101-1+b2
ii  liburi-perl                1.76-2
ii  perl                       5.30.0-10

libtext-vcard-perl recommends no packages.

libtext-vcard-perl suggests no packages.

-- no debconf information



More information about the pkg-perl-maintainers mailing list