Coverage Report

Created: 2026-02-09 07:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/augeas/augeas_api_fuzzer.cc
Line
Count
Source
1
/*
2
# Copyright 2020 Google Inc.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#      http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
#
16
################################################################################
17
*/
18
19
20
#include "config.h"
21
#include "augeas.h"
22
#include "internal.h"
23
#include "memory.h"
24
#include "syntax.h"
25
#include "transform.h"
26
#include "errcode.h"
27
28
29
#include <fnmatch.h>
30
#include <argz.h>
31
#include <string.h>
32
#include <stdarg.h>
33
#include <locale.h>
34
35
36
37
102
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
38
102
  if(size<3){
39
0
    return 0;
40
0
  }
41
  
42
102
  char *loadpath = NULL;
43
102
  const char *value;
44
102
  const char *label;
45
102
  char *new_str = (char *)malloc(size+1);
46
102
  if (new_str == NULL){
47
0
    return 0;
48
0
  }
49
102
  memcpy(new_str, data, size);
50
102
  new_str[size] = '\0';
51
  
52
102
  struct augeas *aug = aug_init(new_str, loadpath, AUG_NO_STDINC|AUG_NO_LOAD);
53
102
  aug_defvar(aug, new_str, &new_str[1]);
54
102
  aug_get(aug, new_str, &value);
55
102
  aug_label(aug, new_str, &label);
56
  
57
102
  aug_rename(aug, new_str, &new_str[1]);
58
102
  aug_text_store(aug, &new_str[1], new_str, &new_str[2]); 
59
102
  aug_print(aug, stdout, new_str);
60
102
  aug_setm(aug, new_str, NULL, &new_str[1]); 
61
  
62
102
  free(new_str);
63
102
  aug_close(aug);
64
102
  return 0;
65
102
}