[Bug 1059783] Re: random output when size_to_str() passed values larger than 10^28
Colin Watson
cjwatson at canonical.com
Fri Mar 1 13:19:48 UTC 2013
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;
}
** Package changed: python-apt (Ubuntu) => apt (Ubuntu)
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apt in Ubuntu.
https://bugs.launchpad.net/bugs/1059783
Title:
random output when size_to_str() passed values larger than 10^28
Status in “apt” package in Ubuntu:
Confirmed
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 ;-)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1059783/+subscriptions
More information about the foundations-bugs
mailing list