Coverage Report

Created: 2024-04-23 06:05

/src/sleuthkit_fls_fuzzer.cc
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2020 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include <stddef.h>
16
#include <stdint.h>
17
18
#include "sleuthkit/tsk/tsk_tools_i.h"
19
#include "sleuthkit_mem_img.h"
20
21
#ifndef FSTYPE
22
#error Define FSTYPE as a valid value of TSK_FS_TYPE_ENUM.
23
#endif
24
25
3
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
26
3
  TSK_IMG_INFO *img;
27
3
  TSK_FS_INFO *fs;
28
29
3
  img = mem_open(data, size);
30
3
  if (img == nullptr)
31
0
    return 0;
32
33
3
  fs = tsk_fs_open_img(img, 0, FSTYPE);
34
3
  if (fs != nullptr) {
35
1
    tsk_fs_fls(fs, TSK_FS_FLS_FULL, fs->root_inum, TSK_FS_DIR_WALK_FLAG_RECURSE,
36
1
               nullptr, 0);
37
38
1
    fs->close(fs);
39
1
  }
40
41
3
  img->close(img);
42
3
  return 0;
43
3
}