Coverage Report

Created: 2026-08-13 06:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libpg_query/test/fuzz/fuzz_protobuf.c
Line
Count
Source
1
#include <pg_query.h>
2
3
#include <stdio.h>
4
#include <stdlib.h>
5
#include <string.h>
6
#include <stdbool.h>
7
8
8.83k
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
9
8.83k
  char *new_str = (char *)malloc(size+1);
10
8.83k
  if (new_str == NULL){
11
0
        return 0;
12
0
  }
13
8.83k
  memcpy(new_str, data, size);
14
8.83k
  new_str[size] = '\0';
15
16
8.83k
  PgQueryProtobufParseResult protobuf_result = pg_query_parse_protobuf(new_str);
17
8.83k
  if (protobuf_result.error == NULL) {
18
5.64k
    PgQueryDeparseResult deparse_result = pg_query_deparse_protobuf(protobuf_result.parse_tree);
19
5.64k
    pg_query_free_deparse_result(deparse_result);
20
5.64k
  }
21
8.83k
  pg_query_free_protobuf_parse_result(protobuf_result);
22
23
8.83k
  PgQueryFingerprintResult fingerprint_result = pg_query_fingerprint(new_str);
24
8.83k
  pg_query_free_fingerprint_result(fingerprint_result);
25
26
8.83k
  PgQueryNormalizeResult normalize_result = pg_query_normalize(new_str);
27
8.83k
  pg_query_free_normalize_result(normalize_result);
28
29
8.83k
  PgQueryScanResult scan_result = pg_query_scan(new_str);
30
8.83k
  pg_query_free_scan_result(scan_result);
31
32
8.83k
  free(new_str);
33
8.83k
  return 0;
34
8.83k
}