lib/crc32.c:111:11: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long') lib/crc64.c:101:12: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long') Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- lib/crc32.c | 4 +++- lib/crc64.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/crc32.c b/lib/crc32.c index eaaa06a..be98f1a 100644 --- a/lib/crc32.c +++ b/lib/crc32.c @@ -108,8 +108,10 @@ uint32_t crc32(uint32_t seed, const unsigned char *buf, size_t len) uint32_t crc = seed; const unsigned char *p = buf; - while(len-- > 0) + while (len) { crc = crc32_tab[(crc ^ *p++) & 0xff] ^ (crc >> 8); + len--; + } return crc; } diff --git a/lib/crc64.c b/lib/crc64.c index 091e95d..0be78e6 100644 --- a/lib/crc64.c +++ b/lib/crc64.c @@ -98,9 +98,10 @@ uint64_t crc64(uint64_t seed, const unsigned char *data, size_t len) { uint64_t crc = seed; - while (len--) { + while (len) { int i = ((int) (crc >> 56) ^ *data++) & 0xFF; crc = crc64_tab[i] ^ (crc << 8); + len--; } return crc; -- 2.1.3 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html