Просмотр исходного кода

Dpkg::Changelog: Handle undef versions

When the changelog entry header line has an empty versions, the code was
trying to use an undef version to access a hash.
Guillem Jover лет назад: 10
Родитель
Сommit
396e171581
2 измененных файлов с 6 добавлено и 2 удалено
  1. 2 0
      debian/changelog
  2. 4 2
      scripts/Dpkg/Changelog.pm

+ 2 - 0
debian/changelog

@@ -110,6 +110,8 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
       check_header() and check_trailer() ones.
     - Use “GnuPG” instead of “gpg” in error messages to refer to the software
       in Dpkg::Source::Package.
+    - Handle undef versions in Dpkg::Changelog from empty versions in
+      changelog entry header lines.
   * Build system:
     - Fix building development documentation.
     - Remove unused UA_LIBS variable.

+ 4 - 2
scripts/Dpkg/Changelog.pm

@@ -246,8 +246,10 @@ sub __sanity_check_range {
     # Handle non-existing versions
     my (%versions, @versions);
     foreach my $entry (@{$data}) {
-        $versions{$entry->get_version()->as_string()} = 1;
-        push @versions, $entry->get_version()->as_string();
+        my $version = $entry->get_version();
+        next unless defined $version;
+        $versions{$version->as_string()} = 1;
+        push @versions, $version->as_string();
     }
     if ((defined($r->{since}) and not exists $versions{$r->{since}})) {
         warning(g_("'%s' option specifies non-existing version"), 'since');