From 8762512fdb088acefb9f3ea5f7b1e1bf2d336ff3 Mon Sep 17 00:00:00 2001 From: Rostislav Skudnov Date: Wed, 1 Feb 2017 18:35:13 +0000 Subject: Replace int -> uint to avoid signed integer overflow An example of such an error (should be compiled with DEBUG_SANITIZE): runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Rostislav Skudnov Signed-off-by: Denys Vlasenko --- libbb/crc32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libbb/crc32.c') diff --git a/libbb/crc32.c b/libbb/crc32.c index ac9836cc9..0711ca84e 100644 --- a/libbb/crc32.c +++ b/libbb/crc32.c @@ -24,7 +24,7 @@ uint32_t* FAST_FUNC crc32_filltable(uint32_t *crc_table, int endian) { uint32_t polynomial = endian ? 0x04c11db7 : 0xedb88320; uint32_t c; - int i, j; + unsigned i, j; if (!crc_table) crc_table = xmalloc(256 * sizeof(uint32_t)); -- cgit v1.2.3