Coverage Report

Created: 2025-07-23 06:44

/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
404
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
404
  char* in = malloc(size + 1);
17
404
  memcpy(in, data, size);
18
404
  in[size] = '\0';
19
20
404
  struct amqp_connection_info ci;
21
404
  amqp_parse_url(in, &ci);
22
404
  free(in);
23
404
  return 0;
24
404
}