summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-12-04 23:16:04 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-12-04 23:16:04 +0100
commitd63772845a28a08ea9c812ad8ac281cf9e0ae12a (patch)
treef33b0f3f637e1be7f1401cb6b3fcecb4fe6281f8 /test
parenteefadade6e886d9423c5d3145858891047c46abc (diff)
HexDigest: Silence -Wstringop-overflow
The compiler does not know that the size is small and thinks we might be doing a stack buffer overflow of the vla: Add APT_ASSUME macro and silence -Wstringop-overflow in HexDigest() The compiler does not know that the size of a hash is at most 512 bit, so tell it that it is. ../apt-pkg/contrib/hashes.cc: In function ‘std::string HexDigest(gcry_md_hd_t, int)’: ../apt-pkg/contrib/hashes.cc:415:21: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 415 | Result[(Size)*2] = 0; | ~~~~~~~~~~~~~~~~~^~~ ../apt-pkg/contrib/hashes.cc:414:9: note: at offset [-9223372036854775808, 9223372036854775807] to an object with size at most 4294967295 declared here 414 | char Result[((Size)*2) + 1]; | ^~~~~~ Fix this by adding a simple assertion. This generates an extra two instructions in the normal code path, so it's not exactly super costly.
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions