Coverage Report

Created: 2025-07-11 06:40

/src/fuzz_addr_parse.c
Line
Count
Source (jump to first uncovered line)
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
#include <stddef.h>
13
#include <stdint.h>
14
#include <stdlib.h>
15
16
#include "apr_network_io.h"
17
18
410
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
19
410
  apr_pool_t *pool;
20
410
  apr_pool_initialize();
21
410
  if (apr_pool_create(&pool, NULL) != APR_SUCCESS) {
22
0
    abort();
23
0
  }
24
25
410
  char *addr = NULL;
26
410
  char *scope_id = NULL;
27
410
  apr_port_t port = 0;
28
410
  char *input_string = strndup((const char *)data, size);
29
30
410
  apr_parse_addr_port(&addr, &scope_id, &port, input_string, pool);
31
32
410
  free(input_string);
33
410
  apr_pool_destroy(pool);
34
410
  apr_pool_terminate();
35
36
410
  return 0;
37
410
}