random output when size_to_str() passed values larger than 10^28

Bug #1059783 reported by James Hunt on 2012-10-01
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Low
Unassigned

Bug Description

# correct output ("10000 Y" or 10k yottabytes)
$ python2.7 -c 'import apt_pkg; print(apt_pkg.size_to_str(10 ** 28))' |od -xc
0000000 3031 3030 2030 0a59
          1 0 0 0 0 Y \n
0000010

# incorrect output: random output!
$ python2.7 -c 'import apt_pkg; print(apt_pkg.size_to_str(10 ** 29))' |od -xc
0000000 75b0 01ff 8020 b74c 000a
        260 u 377 001 200 L 267 \n
0000011

Admittedly, it'll probably be a while before this becomes an issue ;-)

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-apt (Ubuntu):
status: New → Confirmed
Barry Warsaw (barry) wrote :

This affects me because my hard drive goes to 11.

Changed in python-apt (Ubuntu):
importance: Undecided → Low
Colin Watson (cjwatson) wrote :

Reproducible with a C++ program linked against libapt-pkg.

#include <apt-pkg/strutl.h>
#include <stdio.h>

void show(double size)
{
    std::string out = SizeToStr(size);
    printf("SizeToStr(%f) = '%s'\n", size, out.c_str());
}

int main()
{
    show(100000000000000000000000000000.0L);
    return 0;
}

affects: python-apt (Ubuntu) → apt (Ubuntu)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers