Coverage Report

Created: 2026-12-01 06:34

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/unbound/parse_packet_fuzzer.c
Line
Count
Source
1
/* Copyright 2021 Google LLC
2
Licensed under the Apache License, Version 2.0 (the "License");
3
you may not use this file except in compliance with the License.
4
You may obtain a copy of the License at
5
      http://www.apache.org/licenses/LICENSE-2.0
6
Unless required by applicable law or agreed to in writing, software
7
distributed under the License is distributed on an "AS IS" BASIS,
8
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
See the License for the specific language governing permissions and
10
limitations under the License.
11
*/
12
13
#include "config.h"
14
#include "util/regional.h"
15
#include "util/fptr_wlist.h"
16
#include "sldns/sbuffer.h"
17
18
struct regional * region = NULL;
19
20
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
21
2.75k
{
22
2.75k
  if (!region) {
23
1
    region = regional_create();
24
1
    if (!region) {
25
0
      abort();
26
0
    }
27
1
  }
28
2.75k
  sldns_buffer pktbuf;
29
2.75k
  sldns_buffer_init_frm_data(&pktbuf, (void*)buf, len);
30
31
2.75k
  struct msg_parse prs;
32
2.75k
  memset(&prs, 0, sizeof(prs));
33
2.75k
  parse_packet(&pktbuf, &prs, region);
34
2.75k
  regional_free_all(region);
35
2.75k
  return 0;
36
2.75k
}