1 // SPDX-License-Identifier: 0BSD
3 ///////////////////////////////////////////////////////////////////////////////
5 /// \file fuzz_decode_alone.c
6 /// \brief Fuzz test program for liblzma .lzma decoding
8 // Authors: Maksym Vatsyk
11 ///////////////////////////////////////////////////////////////////////////////
17 #include "fuzz_common.h"
21 LLVMFuzzerTestOneInput(const uint8_t *inbuf
, size_t inbuf_size
)
23 lzma_stream strm
= LZMA_STREAM_INIT
;
24 // Initialize a LZMA alone decoder using the memory usage limit
25 // defined in fuzz_common.h
26 lzma_ret ret
= lzma_alone_decoder(&strm
, MEM_LIMIT
);
29 // This should never happen unless the system has
30 // no free memory or address space to allow the small
31 // allocations that the initialization requires.
32 fprintf(stderr
, "lzma_alone_decoder() failed (%d)\n", ret
);
36 fuzz_code(&strm
, inbuf
, inbuf_size
);
38 // Free the allocated memory.