From a6375472a41af7f1521369d0c22a858d7051ab18 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 28 Oct 2017 10:59:55 +0200 Subject: Prevent overflow in Installed-Size (and Size) in apt show Installed-Size for linux-image-4.13.0-1-amd64-dbg and friends are larger than 4 GB, but read as a signed integer - that's fine so far, as the value is in KB, but it's multiplied with 1024 which overflows. So let's read it as unsigned long long instead. While we're at it, also use unsigned long long for Size, in case that is bigger than 2 GB. --- test/integration/test-apt-cli-show | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show index 754b3aa5f..935d93d86 100755 --- a/test/integration/test-apt-cli-show +++ b/test/integration/test-apt-cli-show @@ -11,6 +11,7 @@ DESCR='Some description That has multiple lines' insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR" insertpackage 'unstable' 'bar' 'i386,amd64' '1' '' '' "$DESCR" +insertpackage 'unstable' 'big' 'i386,amd64' '1' 'Installed-Size: 4129421' '' "$DESCR" insertinstalledpackage 'foo' 'all' '1.0' setupaptarchive @@ -53,6 +54,17 @@ APT-Sources: file:$APTARCHIVE unstable/main amd64 Packages Description: Some description That has multiple lines " apt show bar:amd64 +testsuccessequal "Package: big:amd64 +Version: 1 +Priority: optional +Section: other +Maintainer: Joe Sixpack +Installed-Size: 4229 MB +Download-Size: unknown +APT-Sources: file:$APTARCHIVE unstable/main amd64 Packages +Description: Some description + That has multiple lines +" apt show big:amd64 # this is the default, but disabled by the testcases testsuccess apt show foo -o Apt::Cmd::Disable-Script-Warning=0 -- cgit v1.2.3