igzip: Remove undefined unaligned loads

Change-Id: I02591d958f8691d07b261218cf5ab361e8ad36c9
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
Roy Oursler 2018-12-13 14:12:51 -07:00
parent 733901ee32
commit 5be1ba2215
10 changed files with 100 additions and 39 deletions

View File

@ -680,7 +680,7 @@ void isal_update_histogram_base(uint8_t * start_stream, int length,
end_stream = start_stream + length; end_stream = start_stream + length;
memset(last_seen, 0, sizeof(histogram->hash_table)); /* Initialize last_seen to be 0. */ memset(last_seen, 0, sizeof(histogram->hash_table)); /* Initialize last_seen to be 0. */
for (current = start_stream; current < end_stream - 3; current++) { for (current = start_stream; current < end_stream - 3; current++) {
literal = *(uint32_t *) current; literal = load_u32(current);
hash = compute_hash(literal) & LVL0_HASH_MASK; hash = compute_hash(literal) & LVL0_HASH_MASK;
seen = last_seen[hash]; seen = last_seen[hash];
last_seen[hash] = (current - start_stream) & 0xFFFF; last_seen[hash] = (current - start_stream) & 0xFFFF;
@ -700,7 +700,7 @@ void isal_update_histogram_base(uint8_t * start_stream, int length,
end = end_stream - 3; end = end_stream - 3;
next_hash++; next_hash++;
for (; next_hash < end; next_hash++) { for (; next_hash < end; next_hash++) {
literal = *(uint32_t *) next_hash; literal = load_u32(next_hash);
hash = compute_hash(literal) & LVL0_HASH_MASK; hash = compute_hash(literal) & LVL0_HASH_MASK;
last_seen[hash] = (next_hash - start_stream) & 0xFFFF; last_seen[hash] = (next_hash - start_stream) & 0xFFFF;
} }

View File

@ -31,6 +31,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include "igzip_lib.h" #include "igzip_lib.h"
#include "unaligned.h"
#if __x86_64__ || __i386__ || _M_X64 || _M_IX86 #if __x86_64__ || __i386__ || _M_X64 || _M_IX86
#ifdef _MSC_VER #ifdef _MSC_VER
@ -240,8 +241,8 @@ static inline int compare258(uint8_t * str1, uint8_t * str2, uint32_t max_length
loop_length = max_length & ~0x7; loop_length = max_length & ~0x7;
for(count = 0; count < loop_length; count += 8){ for(count = 0; count < loop_length; count += 8){
test = *(uint64_t *) str1; test = load_u64(str1);
test ^= *(uint64_t *) str2; test ^= load_u64(str2);
if(test != 0) if(test != 0)
return count + tzbytecnt(test); return count + tzbytecnt(test);
str1 += 8; str1 += 8;
@ -298,8 +299,8 @@ static inline int compare(uint8_t * str1, uint8_t * str2, uint32_t max_length)
loop_length = max_length & ~0x7; loop_length = max_length & ~0x7;
for(count = 0; count < loop_length; count += 8){ for(count = 0; count < loop_length; count += 8){
test = *(uint64_t *) str1; test = load_u64(str1);
test ^= *(uint64_t *) str2; test ^= load_u64(str2);
if(test != 0) if(test != 0)
return count + tzbytecnt(test); return count + tzbytecnt(test);
str1 += 8; str1 += 8;

View File

@ -52,6 +52,7 @@
#include "igzip_level_buf_structs.h" #include "igzip_level_buf_structs.h"
#include "igzip_checksums.h" #include "igzip_checksums.h"
#include "igzip_wrapper.h" #include "igzip_wrapper.h"
#include "unaligned.h"
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#include <sys/types.h> #include <sys/types.h>
@ -741,8 +742,8 @@ static int isal_deflate_int_stateless(struct isal_zstream *stream)
return STATELESS_OVERFLOW; return STATELESS_OVERFLOW;
if (stream->avail_in >= 8 if (stream->avail_in >= 8
&& (*(uint64_t *) stream->next_in == 0 && (load_u64(stream->next_in) == 0
|| *(uint64_t *) stream->next_in == ~(uint64_t) 0)) { || load_u64(stream->next_in) == ~(uint64_t) 0)) {
repeat_length = detect_repeated_char_length(stream->next_in, stream->avail_in); repeat_length = detect_repeated_char_length(stream->next_in, stream->avail_in);
if (stream->avail_in == repeat_length || repeat_length >= MIN_REPEAT_LEN) if (stream->avail_in == repeat_length || repeat_length >= MIN_REPEAT_LEN)

View File

@ -58,7 +58,7 @@ void isal_deflate_body_base(struct isal_zstream *stream)
return; return;
} }
literal = *(uint32_t *) next_in; literal = load_u32(next_in);
hash = compute_hash(literal) & hash_mask; hash = compute_hash(literal) & hash_mask;
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF; dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
last_seen[hash] = (uint64_t) (next_in - file_start); last_seen[hash] = (uint64_t) (next_in - file_start);
@ -79,7 +79,7 @@ void isal_deflate_body_base(struct isal_zstream *stream)
next_hash++; next_hash++;
for (; next_hash < end; next_hash++) { for (; next_hash < end; next_hash++) {
literal = *(uint32_t *) next_hash; literal = load_u32(next_hash);
hash = compute_hash(literal) & hash_mask; hash = compute_hash(literal) & hash_mask;
last_seen[hash] = (uint64_t) (next_hash - file_start); last_seen[hash] = (uint64_t) (next_hash - file_start);
} }
@ -140,7 +140,7 @@ void isal_deflate_finish_base(struct isal_zstream *stream)
return; return;
} }
literal = *(uint32_t *) next_in; literal = load_u32(next_in);
hash = compute_hash(literal) & hash_mask; hash = compute_hash(literal) & hash_mask;
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF; dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
last_seen[hash] = (uint64_t) (next_in - file_start); last_seen[hash] = (uint64_t) (next_in - file_start);
@ -159,7 +159,7 @@ void isal_deflate_finish_base(struct isal_zstream *stream)
next_hash++; next_hash++;
for (; next_hash < end - 3; next_hash++) { for (; next_hash < end - 3; next_hash++) {
literal = *(uint32_t *) next_hash; literal = load_u32(next_hash);
hash = compute_hash(literal) & hash_mask; hash = compute_hash(literal) & hash_mask;
last_seen[hash] = last_seen[hash] =
(uint64_t) (next_hash - file_start); (uint64_t) (next_hash - file_start);
@ -227,7 +227,7 @@ void isal_deflate_hash_base(uint16_t * hash_table, uint32_t hash_mask,
uint16_t index = current_index - dict_len; uint16_t index = current_index - dict_len;
while (next_in <= end_in) { while (next_in <= end_in) {
literal = *(uint32_t *) next_in; literal = load_u32(next_in);
hash = compute_hash(literal) & hash_mask; hash = compute_hash(literal) & hash_mask;
hash_table[hash] = index; hash_table[hash] = index;
index++; index++;

View File

@ -4,6 +4,7 @@
#include "huff_codes.h" #include "huff_codes.h"
#include "encode_df.h" #include "encode_df.h"
#include "igzip_level_buf_structs.h" #include "igzip_level_buf_structs.h"
#include "unaligned.h"
static inline void write_deflate_icf(struct deflate_icf *icf, uint32_t lit_len, static inline void write_deflate_icf(struct deflate_icf *icf, uint32_t lit_len,
uint32_t lit_dist, uint32_t extra_bits) uint32_t lit_dist, uint32_t extra_bits)
@ -72,7 +73,7 @@ void isal_deflate_icf_body_hash_hist_base(struct isal_zstream *stream)
return; return;
} }
literal = *(uint32_t *) next_in; literal = load_u32(next_in);
hash = compute_hash(literal) & hash_mask; hash = compute_hash(literal) & hash_mask;
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF; dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
last_seen[hash] = (uint64_t) (next_in - file_start); last_seen[hash] = (uint64_t) (next_in - file_start);
@ -93,7 +94,7 @@ void isal_deflate_icf_body_hash_hist_base(struct isal_zstream *stream)
next_hash++; next_hash++;
for (; next_hash < end; next_hash++) { for (; next_hash < end; next_hash++) {
literal = *(uint32_t *) next_hash; literal = load_u32(next_hash);
hash = compute_hash(literal) & hash_mask; hash = compute_hash(literal) & hash_mask;
last_seen[hash] = (uint64_t) (next_hash - file_start); last_seen[hash] = (uint64_t) (next_hash - file_start);
} }
@ -167,7 +168,7 @@ void isal_deflate_icf_finish_hash_hist_base(struct isal_zstream *stream)
return; return;
} }
literal = *(uint32_t *) next_in; literal = load_u32(next_in);
hash = compute_hash(literal) & hash_mask; hash = compute_hash(literal) & hash_mask;
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF; dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
last_seen[hash] = (uint64_t) (next_in - file_start); last_seen[hash] = (uint64_t) (next_in - file_start);
@ -185,7 +186,7 @@ void isal_deflate_icf_finish_hash_hist_base(struct isal_zstream *stream)
next_hash++; next_hash++;
for (; next_hash < end - 3; next_hash++) { for (; next_hash < end - 3; next_hash++) {
literal = *(uint32_t *) next_hash; literal = load_u32(next_hash);
hash = compute_hash(literal) & hash_mask; hash = compute_hash(literal) & hash_mask;
last_seen[hash] = (uint64_t) (next_hash - file_start); last_seen[hash] = (uint64_t) (next_hash - file_start);
} }
@ -277,7 +278,7 @@ void isal_deflate_icf_finish_hash_map_base(struct isal_zstream *stream)
return; return;
} }
literal = *(uint32_t *) next_in; literal = load_u32(next_in);
hash = compute_hash_mad(literal) & hash_mask; hash = compute_hash_mad(literal) & hash_mask;
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF; dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
last_seen[hash] = (uint64_t) (next_in - file_start); last_seen[hash] = (uint64_t) (next_in - file_start);
@ -295,7 +296,7 @@ void isal_deflate_icf_finish_hash_map_base(struct isal_zstream *stream)
next_hash++; next_hash++;
for (; next_hash < end - 3; next_hash++) { for (; next_hash < end - 3; next_hash++) {
literal = *(uint32_t *) next_hash; literal = load_u32(next_hash);
hash = compute_hash_mad(literal) & hash_mask; hash = compute_hash_mad(literal) & hash_mask;
last_seen[hash] = (uint64_t) (next_hash - file_start); last_seen[hash] = (uint64_t) (next_hash - file_start);
} }
@ -360,7 +361,7 @@ void isal_deflate_hash_mad_base(uint16_t * hash_table, uint32_t hash_mask,
uint16_t index = current_index - dict_len; uint16_t index = current_index - dict_len;
while (next_in <= end_in) { while (next_in <= end_in) {
literal = *(uint32_t *) next_in; literal = load_u32(next_in);
hash = compute_hash_mad(literal) & hash_mask; hash = compute_hash_mad(literal) & hash_mask;
hash_table[hash] = index; hash_table[hash] = index;
index++; index++;

View File

@ -94,7 +94,7 @@ uint64_t gen_icf_map_h1_base(struct isal_zstream *stream,
matches_icf_lookup->lit_dist = 0x1e; matches_icf_lookup->lit_dist = 0x1e;
matches_icf_lookup->dist_extra = 0; matches_icf_lookup->dist_extra = 0;
hash = compute_hash(*(uint32_t *) next_in) & hash_mask; hash = compute_hash(load_u32(next_in)) & hash_mask;
hash_table[hash] = (uint64_t) (next_in - file_start); hash_table[hash] = (uint64_t) (next_in - file_start);
next_in++; next_in++;
@ -103,13 +103,13 @@ uint64_t gen_icf_map_h1_base(struct isal_zstream *stream,
} }
while (next_in < end_in - ISAL_LOOK_AHEAD) { while (next_in < end_in - ISAL_LOOK_AHEAD) {
hash = compute_hash(*(uint32_t *) next_in) & hash_mask; hash = compute_hash(load_u32(next_in)) & hash_mask;
dist = (next_in - file_start - hash_table[hash]); dist = (next_in - file_start - hash_table[hash]);
dist = ((dist - 1) & hist_size) + 1; dist = ((dist - 1) & hist_size) + 1;
hash_table[hash] = (uint64_t) (next_in - file_start); hash_table[hash] = (uint64_t) (next_in - file_start);
match_bytes = *(uint64_t *) (next_in - dist); match_bytes = load_u64(next_in - dist);
next_bytes = *(uint64_t *) next_in; next_bytes = load_u64(next_in);
match = next_bytes ^ match_bytes; match = next_bytes ^ match_bytes;
len = tzbytecnt(match); len = tzbytecnt(match);
@ -147,7 +147,7 @@ static struct deflate_icf *compress_icf_map_g(struct isal_zstream *stream,
level_buf->icf_buf_avail_out / sizeof(struct deflate_icf); level_buf->icf_buf_avail_out / sizeof(struct deflate_icf);
while (matches_next < matches_end - 1 && level_buf->icf_buf_next < icf_buf_end - 1) { while (matches_next < matches_end - 1 && level_buf->icf_buf_next < icf_buf_end - 1) {
code = *(uint64_t *) matches_next; code = load_u64((uint8_t *) matches_next);
lit_len = code & LIT_LEN_MASK; lit_len = code & LIT_LEN_MASK;
lit_len2 = (code >> ICF_CODE_LEN) & LIT_LEN_MASK; lit_len2 = (code >> ICF_CODE_LEN) & LIT_LEN_MASK;
level_buf->hist.ll_hist[lit_len]++; level_buf->hist.ll_hist[lit_len]++;
@ -184,7 +184,7 @@ static struct deflate_icf *compress_icf_map_g(struct isal_zstream *stream,
} }
while (matches_next < matches_end && level_buf->icf_buf_next < icf_buf_end) { while (matches_next < matches_end && level_buf->icf_buf_next < icf_buf_end) {
code = *(uint32_t *) matches_next; code = load_u32((uint8_t *) matches_next);
lit_len = code & LIT_LEN_MASK; lit_len = code & LIT_LEN_MASK;
*(uint32_t *) level_buf->icf_buf_next = code; *(uint32_t *) level_buf->icf_buf_next = code;
level_buf->icf_buf_next++; level_buf->icf_buf_next++;

View File

@ -33,6 +33,7 @@
#include "huff_codes.h" #include "huff_codes.h"
#include "igzip_checksums.h" #include "igzip_checksums.h"
#include "igzip_wrapper.h" #include "igzip_wrapper.h"
#include "unaligned.h"
#ifndef NO_STATIC_INFLATE_H #ifndef NO_STATIC_INFLATE_H
#include "static_inflate.h" #include "static_inflate.h"
@ -253,7 +254,7 @@ static void inline inflate_in_load(struct inflate_state *state, int min_required
/* If there is enough space to load a 64 bits, load the data and use /* If there is enough space to load a 64 bits, load the data and use
* that to fill read_in */ * that to fill read_in */
new_bytes = 8 - (state->read_in_length + 7) / 8; new_bytes = 8 - (state->read_in_length + 7) / 8;
temp = *(uint64_t *) state->next_in; temp = load_u64(state->next_in);
state->read_in |= temp << state->read_in_length; state->read_in |= temp << state->read_in_length;
state->next_in += new_bytes; state->next_in += new_bytes;
@ -1879,7 +1880,7 @@ static int check_gzip_checksum(struct inflate_state *state)
return ret; return ret;
} }
trailer = *(uint64_t *) next_in; trailer = load_u64(next_in);
} }
state->block_state = ISAL_BLOCK_FINISH; state->block_state = ISAL_BLOCK_FINISH;
@ -1930,7 +1931,7 @@ static int check_zlib_checksum(struct inflate_state *state)
return ret; return ret;
} }
trailer = *(uint32_t *) next_in; trailer = load_u32(next_in);
} }
state->block_state = ISAL_BLOCK_FINISH; state->block_state = ISAL_BLOCK_FINISH;
@ -1969,7 +1970,7 @@ int isal_read_gzip_header(struct inflate_state *state, struct isal_gzip_header *
id2 = next_in[1]; id2 = next_in[1];
cm = next_in[2]; cm = next_in[2];
flags = next_in[3]; flags = next_in[3];
gz_hdr->time = *(uint32_t *) (next_in + 4); gz_hdr->time = load_u32(next_in + 4);
gz_hdr->xflags = *(next_in + 8); gz_hdr->xflags = *(next_in + 8);
gz_hdr->os = *(next_in + 9); gz_hdr->os = *(next_in + 9);
@ -1993,7 +1994,7 @@ int isal_read_gzip_header(struct inflate_state *state, struct isal_gzip_header *
break; break;
} }
xlen = *(uint16_t *) next_in; xlen = load_u16(next_in);
count = xlen; count = xlen;
gz_hdr->extra_len = xlen; gz_hdr->extra_len = xlen;
@ -2048,7 +2049,7 @@ int isal_read_gzip_header(struct inflate_state *state, struct isal_gzip_header *
return ret; return ret;
} }
if ((hcrc & 0xffff) != *(uint16_t *) next_in) if ((hcrc & 0xffff) != load_u16(next_in))
return ISAL_INCORRECT_CHECKSUM; return ISAL_INCORRECT_CHECKSUM;
} }
@ -2099,7 +2100,7 @@ int isal_read_zlib_header(struct inflate_state *state, struct isal_zlib_header *
break; break;
} }
zlib_hdr->dict_id = *(int32_t *) next_in; zlib_hdr->dict_id = load_u32(next_in);
} }
state->wrapper_flag = 1; state->wrapper_flag = 1;

View File

@ -37,6 +37,7 @@
#include "inflate_std_vects.h" #include "inflate_std_vects.h"
#include <math.h> #include <math.h>
#include "test.h" #include "test.h"
#include "unaligned.h"
#ifndef RANDOMS #ifndef RANDOMS
# define RANDOMS 0x40 # define RANDOMS 0x40
@ -451,7 +452,7 @@ int inflate_stateless_pass(uint8_t * compress_buf, uint64_t compress_len,
if (!ret) if (!ret)
ret = ret =
check_gzip_trl(*(uint64_t *) (state.next_in - offset), check_gzip_trl(load_u64(state.next_in - offset),
state.crc, uncompress_buf, *uncompress_len); state.crc, uncompress_buf, *uncompress_len);
else if (ret == ISAL_INCORRECT_CHECKSUM) else if (ret == ISAL_INCORRECT_CHECKSUM)
ret = INCORRECT_GZIP_TRAILER; ret = INCORRECT_GZIP_TRAILER;
@ -463,7 +464,7 @@ int inflate_stateless_pass(uint8_t * compress_buf, uint64_t compress_len,
if (!ret) if (!ret)
ret = ret =
check_zlib_trl(*(uint32_t *) (state.next_in - offset), check_zlib_trl(load_u32(state.next_in - offset),
state.crc, uncompress_buf, *uncompress_len); state.crc, uncompress_buf, *uncompress_len);
else if (ret == ISAL_INCORRECT_CHECKSUM) else if (ret == ISAL_INCORRECT_CHECKSUM)
ret = INCORRECT_ZLIB_TRAILER; ret = INCORRECT_ZLIB_TRAILER;
@ -710,7 +711,7 @@ int inflate_multi_pass(uint8_t * compress_buf, uint64_t compress_len,
|| gzip_flag == IGZIP_GZIP) || gzip_flag == IGZIP_GZIP)
compress_len -= gzip_trl_bytes; compress_len -= gzip_trl_bytes;
ret = ret =
check_gzip_trl(*(uint64_t *) & compress_buf[compress_len], check_gzip_trl(load_u64(compress_buf + compress_len),
state->crc, uncompress_buf, state->crc, uncompress_buf,
*uncompress_len); *uncompress_len);
} else if (gzip_flag == IGZIP_ZLIB_NO_HDR) { } else if (gzip_flag == IGZIP_ZLIB_NO_HDR) {
@ -718,7 +719,7 @@ int inflate_multi_pass(uint8_t * compress_buf, uint64_t compress_len,
|| gzip_flag == ISAL_ZLIB_NO_HDR_VER) || gzip_flag == ISAL_ZLIB_NO_HDR_VER)
compress_len -= zlib_trl_bytes; compress_len -= zlib_trl_bytes;
ret = ret =
check_zlib_trl(*(uint32_t *) & compress_buf[compress_len], check_zlib_trl(load_u32(compress_buf + compress_len),
state->crc, uncompress_buf, state->crc, uncompress_buf,
*uncompress_len); *uncompress_len);
} }

55
include/unaligned.h Normal file
View File

@ -0,0 +1,55 @@
/**********************************************************************
Copyright(c) 2011-2019 Intel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Intel Corporation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**********************************************************************/
#ifndef UNALIGNED_H
#define UNALIGNED_H
#include "stdint.h"
#include "string.h"
static inline uint16_t load_u16(uint8_t * buf) {
uint16_t ret;
memcpy(&ret, buf, sizeof(ret));
return ret;
}
static inline uint32_t load_u32(uint8_t * buf) {
uint32_t ret;
memcpy(&ret, buf, sizeof(ret));
return ret;
}
static inline uint64_t load_u64(uint8_t * buf) {
uint64_t ret;
memcpy(&ret, buf, sizeof(ret));
return ret;
}
#endif

View File

@ -5,6 +5,7 @@
#include <assert.h> #include <assert.h>
#include <byteswap.h> #include <byteswap.h>
#include "igzip_lib.h" #include "igzip_lib.h"
#include "unaligned.h"
#define LEVEL_BITS 2 #define LEVEL_BITS 2
#define HEADER_BITS 3 #define HEADER_BITS 3
@ -117,9 +118,9 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
int trailer_idx = cstate.total_out - trailer_size[wrapper_type]; int trailer_idx = cstate.total_out - trailer_size[wrapper_type];
if (wrapper_type == IGZIP_GZIP || wrapper_type == IGZIP_GZIP_NO_HDR) if (wrapper_type == IGZIP_GZIP || wrapper_type == IGZIP_GZIP_NO_HDR)
crc = *(uint32_t *) & isal_cmp_buf[trailer_idx]; crc = load_u32(&isal_cmp_buf[trailer_idx]);
else if (wrapper_type == IGZIP_ZLIB || wrapper_type == IGZIP_ZLIB_NO_HDR) else if (wrapper_type == IGZIP_ZLIB || wrapper_type == IGZIP_ZLIB_NO_HDR)
crc = bswap_32(*(uint32_t *) & isal_cmp_buf[trailer_idx]); crc = bswap_32(load_u32(&isal_cmp_buf[trailer_idx]));
assert(istate.crc == crc); assert(istate.crc == crc);
free(isal_cmp_buf); free(isal_cmp_buf);