igzip: Fix igzip fuzz test for lev2-3 buf size

Also remove unnecessary deps in igzip makefile.

Change-Id: I1ff79461df6d60bfc52c99b574c39098f1fe238a
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
This commit is contained in:
Greg Tucker 2017-11-21 13:26:49 -07:00
parent 6b1c9a95c8
commit 22ec5c7469
2 changed files with 22 additions and 9 deletions

View File

@ -123,6 +123,3 @@ igzip_inflate_test: LDLIBS += -lz
igzip_igzip_inflate_test_LDADD = libisal.la
igzip_igzip_inflate_test_LDFLAGS = -lz
igzip_igzip_hist_perf_LDADD = libisal.la
igzip_fuzz_inflate: LDLIBS += -lz
igzip_igzip_fuzz_inflate_LDADD = libisal.la
igzip_igzip_fuzz_inflate_LDFLAGS = -lz

View File

@ -55,12 +55,28 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
wrapper_type = (in_param & HEADER_BIT_MASK) % (IGZIP_ZLIB_NO_HDR + 1);
in_param >>= HEADER_BITS;
lev_buf_size = (0 == level) ?
ISAL_DEF_LVL0_MIN + (in_param) * (ISAL_DEF_LVL0_EXTRA_LARGE /
LEVEL_BIT_MASK) :
ISAL_DEF_LVL1_MIN + (in_param) * (ISAL_DEF_LVL1_EXTRA_LARGE /
LEVEL_BIT_MASK);
switch (level) {
case 0:
lev_buf_size = ISAL_DEF_LVL0_MIN + (in_param) *
(ISAL_DEF_LVL0_EXTRA_LARGE / LEVEL_BIT_MASK);
break;
case 1:
lev_buf_size = ISAL_DEF_LVL1_MIN + (in_param) *
(ISAL_DEF_LVL1_EXTRA_LARGE / LEVEL_BIT_MASK);
break;
#ifdef ISAL_DEF_LVL2_MIN
case 2:
lev_buf_size = ISAL_DEF_LVL2_MIN + (in_param) *
(ISAL_DEF_LVL2_EXTRA_LARGE / LEVEL_BIT_MASK);
break;
#endif
#ifdef ISAL_DEF_LVL3_MIN
case 3:
lev_buf_size = ISAL_DEF_LVL3_MIN + (in_param) *
(ISAL_DEF_LVL3_EXTRA_LARGE / LEVEL_BIT_MASK);
break;
#endif
}
if (0 == level)
cmp_buf_size = 2 * size + ISAL_DEF_MAX_HDR_SIZE;
else