Coverage Report

Created: 2023-10-10 06:39

/proc/self/cwd/opencensus/trace/internal/b3_fuzzer.cc
Line
Count
Source
1
// Copyright 2019, OpenCensus Authors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include "absl/strings/string_view.h"
16
#include "opencensus/trace/propagation/b3.h"
17
18
using ::opencensus::trace::propagation::FromB3Headers;
19
20
static constexpr char valid_trace_id[] = "463ac35c9f6413ad48485a3953bb612";
21
static constexpr char valid_span_id[] = "0020000000000001";
22
static constexpr char valid_sampled[] = "1";
23
static constexpr char valid_flags[] = "";
24
25
2.25k
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
26
2.25k
  absl::string_view input(reinterpret_cast<const char *>(Data), Size);
27
2.25k
  FromB3Headers(input, input, input, input);
28
2.25k
  FromB3Headers(input, valid_span_id, valid_sampled, valid_flags);
29
2.25k
  FromB3Headers(valid_trace_id, input, valid_sampled, valid_flags);
30
2.25k
  FromB3Headers(valid_trace_id, valid_span_id, input, valid_flags);
31
2.25k
  FromB3Headers(valid_trace_id, valid_span_id, valid_sampled, input);
32
2.25k
  return 0;
33
2.25k
}