aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorRostislav Skudnov <rostislav@tuxera.com>2017-02-01 18:35:13 +0000
committerDenys Vlasenko <vda.linux@googlemail.com>2017-02-04 23:10:22 +0100
commit8762512fdb088acefb9f3ea5f7b1e1bf2d336ff3 (patch)
tree309e04746b4bcb6f2ad645b29f7fcecfbff339e5 /archival
parentc31b54fd81690b3df3898437f5865674d06e6577 (diff)
downloadbusybox-w32-8762512fdb088acefb9f3ea5f7b1e1bf2d336ff3.tar.gz
busybox-w32-8762512fdb088acefb9f3ea5f7b1e1bf2d336ff3.tar.bz2
busybox-w32-8762512fdb088acefb9f3ea5f7b1e1bf2d336ff3.zip
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 fe5953da2..4fb989c29 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)
134 134
135 /* Avoid 32-bit overflow (dump bit buffer to top of output) */ 135 /* Avoid 32-bit overflow (dump bit buffer to top of output) */
136 if (bit_count >= 24) { 136 if (bit_count >= 24) {
137 bits = bd->inbufBits & ((1 << bit_count) - 1); 137 bits = bd->inbufBits & ((1U << bit_count) - 1);
138 bits_wanted -= bit_count; 138 bits_wanted -= bit_count;
139 bits <<= bits_wanted; 139 bits <<= bits_wanted;
140 bit_count = 0; 140 bit_count = 0;
@@ -158,11 +158,11 @@ static int get_next_block(bunzip_data *bd)
158{ 158{
159 struct group_data *hufGroup; 159 struct group_data *hufGroup;
160 int dbufCount, dbufSize, groupCount, *base, *limit, selector, 160 int dbufCount, dbufSize, groupCount, *base, *limit, selector,
161 i, j, t, runPos, symCount, symTotal, nSelectors, byteCount[256]; 161 i, j, runPos, symCount, symTotal, nSelectors, byteCount[256];
162 int runCnt = runCnt; /* for compiler */ 162 int runCnt = runCnt; /* for compiler */
163 uint8_t uc, symToByte[256], mtfSymbol[256], *selectors; 163 uint8_t uc, symToByte[256], mtfSymbol[256], *selectors;
164 uint32_t *dbuf; 164 uint32_t *dbuf;
165 unsigned origPtr; 165 unsigned origPtr, t;
166 166
167 dbuf = bd->dbuf; 167 dbuf = bd->dbuf;
168 dbufSize = bd->dbufSize; 168 dbufSize = bd->dbufSize;