[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1004064: apt-cdrom: Cannot convert Size to integer: out of range



Package: apt
Version: 2.3.14
Severity: normal
User: devel@kali.org
Usertags: origin-kali

Dear Maintainer,

while working on the Kali Linux installer (which is just the Debian
installer with minor modifications), I hit a bug in apt.

The logs I get from the Kali installer go like this:

  base-installer: Writing new source list
  base-installer: Source list entries for this disc are:
  base-installer: deb cdrom:[Kali GNU/Linux rolling ...]/ kali-rolling main
  base-installer: Repeat this process for the rest of the CDs in your set.
  base-installer: E
  base-installer: :
  base-installer: Cannot convert 2538832704 to integer: out of range
  base-installer:
  base-installer: error: error while running apt-cdrom

The error 'Cannot convert ...' comes straight from apt [1]. The number
2538832704 is the size of a very big package in Kali. It's above MAX
INT, so I suspect that somewhere in the apt code, we try to parse Size
as an integer, instead of using a type unsigned long long.

After some more research, I found it:

  apt-pkg/indexcopy.cc
  ----
  bool PackageCopy::GetFile(string &File,unsigned long long &Size)
  {
     File = Section->FindS("Filename");
     Size = Section->FindI("Size");
     if (File.empty() || Size == 0)
        return _error->Error("Cannot find filename or size tag");
     return true;
  }

This `FindI` should really be `FindUUL`.

A patch is on the way.

Thanks,

  Arnaud

----

[1]: https://salsa.debian.org/apt-team/apt/-/blob/main/apt-pkg/tagfile.cc#L770


Reply to: