2 * Copyright (c) 2016-present, Facebook, Inc.
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
11 * This fuzz target fuzzes all of the helper functions that consume compressed
18 #include "fuzz_helpers.h"
19 #include "zstd_helpers.h"
21 int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size)
24 /* Consume the seed to be compatible with the corpora of other decompression
27 FUZZ_seed(&src, &size);
28 /* You can fuzz any helper functions here that are fast, and take zstd
29 * compressed data as input. E.g. don't expect the input to be a dictionary,
30 * so don't fuzz ZSTD_getDictID_fromDict().
32 ZSTD_getFrameContentSize(src, size);
33 ZSTD_getDecompressedSize(src, size);
34 ZSTD_findFrameCompressedSize(src, size);
35 ZSTD_getDictID_fromFrame(src, size);
36 ZSTD_findDecompressedSize(src, size);
37 ZSTD_decompressBound(src, size);
38 ZSTD_frameHeaderSize(src, size);
39 ZSTD_isFrame(src, size);
40 ZSTD_getFrameHeader(&zfh, src, size);
41 ZSTD_getFrameHeader_advanced(&zfh, src, size, ZSTD_f_zstd1);