summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorRostislav Skudnov2017-02-01 18:35:13 +0000
committerDenys Vlasenko2017-02-04 23:10:22 +0100
commit8762512fdb088acefb9f3ea5f7b1e1bf2d336ff3 (patch)
tree309e04746b4bcb6f2ad645b29f7fcecfbff339e5 /archival
parentc31b54fd81690b3df3898437f5865674d06e6577 (diff)
downloadbusybox-8762512fdb088acefb9f3ea5f7b1e1bf2d336ff3.zip
busybox-8762512fdb088acefb9f3ea5f7b1e1bf2d336ff3.tar.gz
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 <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r--archival/libarchive/decompress_bunzip2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/archival/libarchive/decompress_bunzip2.c b/archival/libarchive/decompress_bunzip2.c
index fe5953d..4fb989c 100644
--- a/archival/libarchive/decompress_bunzip2.c
+++ b/archival/libarchive/decompress_bunzip2.c
@@ -134,7 +134,7 @@ static unsigned get_bits(bunzip_data *bd, int bits_wanted)
/* Avoid 32-bit overflow (dump bit buffer to top of output) */
if (bit_count >= 24) {
- bits = bd->inbufBits & ((1 << bit_count) - 1);
+ bits = bd->inbufBits & ((1U << bit_count) - 1);
bits_wanted -= bit_count;
bits <<= bits_wanted;
bit_count = 0;
@@ -158,11 +158,11 @@ static int get_next_block(bunzip_data *bd)
{
struct group_data *hufGroup;
int dbufCount, dbufSize, groupCount, *base, *limit, selector,
- i, j, t, runPos, symCount, symTotal, nSelectors, byteCount[256];
+ i, j, runPos, symCount, symTotal, nSelectors, byteCount[256];
int runCnt = runCnt; /* for compiler */
uint8_t uc, symToByte[256], mtfSymbol[256], *selectors;
uint32_t *dbuf;
- unsigned origPtr;
+ unsigned origPtr, t;
dbuf = bd->dbuf;
dbufSize = bd->dbufSize;