mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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:
parent
0b4132782a
commit
5cd53195fd
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue