Coverage Report

Created: 2025-07-11 07:00

/src/librabbitmq/fuzz/fuzz_url.c
Line
Count
Source
1
// Copyright 2007 - 2022, Alan Antonuk and the rabbitmq-c contributors.
2
// SPDX-License-Identifier: mit
3
4
#include <inttypes.h>
5
#include <stddef.h>
6
#include <stdint.h>
7
#include <stdlib.h>
8
#include <string.h>
9
10
#include <rabbitmq-c/amqp.h>
11
12
399
extern int LLVMFuzzerTestOneInput(const char *data, size_t size) {
13
  // amqp_parse_url expects null-terminated string that it can modify,
14
  // LLVMFuzzer expects that data will not be modified and won't necessarily
15
  // null terminate the string, so do that here.
16
399
  char* in = malloc(size + 1);
17
399
  memcpy(in, data, size);
18
399
  in[size] = '\0';
19
20
399
  struct amqp_connection_info ci;
21
399
  amqp_parse_url(in, &ci);
22
399
  free(in);
23
399
  return 0;
24
399
}