mirror of
https://github.com/intel/isa-l.git
synced 2024-12-12 17:33:50 +01:00
4f59eeda90
Moved the afl fuzz test and added llvm fuzz tests including inflate and round trip compress and inflate. Currently only works with clang, std makefile and libFuzzer installed. Need to add checking and support later when libfuzzer is more tightly integrated into the compiler. Change-Id: I2db9ad2335d6c5ed846886703b58225f67bcc935 Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
23 lines
489 B
C
23 lines
489 B
C
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "igzip_lib.h"
|
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
|
|
{
|
|
struct inflate_state state;
|
|
uint8_t *isal_out_buf = (uint8_t *) (malloc(size * 2));
|
|
size_t out_buf_size = 2 * size;
|
|
|
|
isal_inflate_init(&state);
|
|
state.next_in = (uint8_t *) data;
|
|
state.avail_in = size;
|
|
state.next_out = isal_out_buf;
|
|
state.avail_out = out_buf_size;
|
|
|
|
isal_inflate_stateless(&state);
|
|
|
|
free(isal_out_buf);
|
|
return 0;
|
|
}
|