Skip to content

Commit c071d16

Browse files
committed
Dead checks introduced after previous boundary fixes
1 parent 27cce22 commit c071d16

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

src/lib/deflate-dec.inc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,6 @@ static int read_dynamic_huffman(z_stream *strm, inflate_state *state) {
199199
/* Process code */
200200
if (code < 16) {
201201
/* Literal code length */
202-
if (index >= LL_LENGTHS_MAX) {
203-
return Z_DATA_ERROR;
204-
}
205202
ll_lengths[index++] = code;
206203
} else {
207204
/* Repeat code */

src/lib/otezip.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,6 @@ static long otezip_find_eocd(FILE *fp, uint8_t *eocd_out /*22+*/, size_t *cd_siz
218218
if (otezip_read_fully (fp, buf, search_len) != 0) {
219219
return OTEZIP_ERR_READ;
220220
}
221-
/* Ensure search_len is at least 22 to avoid underflow in the loop below
222-
* and out-of-bounds access in subsequent buffer reads. */
223-
if (search_len < 22) {
224-
return OTEZIP_ERR_INCONS;
225-
}
226221
size_t i;
227222
for (i = search_len - 22; i != (size_t)-1; --i) {
228223
if (otezip_rd32 (buf + i) == OTEZIP_SIG_EOCD) {
@@ -1021,7 +1016,8 @@ static int otezip_compress_data(uint8_t *in_buf, size_t in_size, uint8_t **out_b
10211016
#ifdef OTEZIP_ENABLE_BROTLI
10221017
if (*method == OTEZIP_METHOD_BROTLI) {
10231018
/* Brotli compression (using vendored upstream implementation via wrappers) */
1024-
size_t out_cap = (in_size? (in_size * 2 + 64): 128);
1019+
/* in_size > 0 here since zero-size case is handled at function start */
1020+
size_t out_cap = in_size * 2 + 64;
10251021
*out_buf = (uint8_t *)malloc (out_cap);
10261022
if (!*out_buf) {
10271023
return -1;

0 commit comments

Comments
 (0)