Don't loose precision when parsing image size on 32 bit machines. Presumably fixes #8979.

Signed-off-by: Recursive Madman <recursive.madman@gmx.de>
This commit is contained in:
Recursive Madman 2014-11-10 18:14:12 +01:00
parent 0b4132782a
commit 5cd53195fd
1 changed files with 4 additions and 1 deletions

View File

@ -64,7 +64,10 @@ func LoadImage(root string) (*Image, error) {
// because a layer size of 0 (zero) is valid
img.Size = -1
} else {
size, err := strconv.Atoi(string(buf))
// Using Atoi here instead would temporarily convert the size to a machine
// dependent integer type, which causes images larger than 2^31 bytes to
// display negative sizes on 32-bit machines:
size, err := strconv.ParseInt(string(buf), 10, 64)
if err != nil {
return nil, err
}