Coverage Report

Created: 2026-05-21 06:15

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/trafficserver/tests/fuzzing/fuzz_hpack.cc
Line
Count
Source
1
/** @file
2
3
  fuzzing proxy/http2
4
5
  @section license License
6
7
  Licensed to the Apache Software Foundation (ASF) under one
8
  or more contributor license agreements.  See the NOTICE file
9
  distributed with this work for additional information
10
  regarding copyright ownership.  The ASF licenses this file
11
  to you under the Apache License, Version 2.0 (the
12
  "License"); you may not use this file except in compliance
13
  with the License.  You may obtain a copy of the License at
14
15
      http://www.apache.org/licenses/LICENSE-2.0
16
17
  Unless required by applicable law or agreed to in writing, software
18
  distributed under the License is distributed on an "AS IS" BASIS,
19
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
  See the License for the specific language governing permissions and
21
  limitations under the License.
22
 */
23
24
#include "proxy/http2/HTTP2.h"
25
#include "proxy/hdrs/HuffmanCodec.h"
26
27
0
#define kMinInputLength 8
28
0
#define kMaxInputLength 128
29
30
0
#define INITIAL_TABLE_SIZE      4096
31
0
#define MAX_REQUEST_HEADER_SIZE 131072
32
0
#define MAX_TABLE_SIZE          4096
33
34
extern int cmd_disable_pfreelist;
35
36
extern "C" int
37
LLVMFuzzerTestOneInput(const uint8_t *input_data, size_t size_data)
38
0
{
39
0
  if (size_data < kMinInputLength || size_data > kMaxInputLength) {
40
0
    return 0;
41
0
  }
42
43
0
  cmd_disable_pfreelist = true;
44
45
0
  HpackIndexingTable       indexing_table(INITIAL_TABLE_SIZE);
46
0
  std::unique_ptr<HTTPHdr> headers(new HTTPHdr);
47
0
  headers->create(HTTPType::REQUEST);
48
49
0
  hpack_decode_header_block(indexing_table, headers.get(), input_data, size_data, MAX_REQUEST_HEADER_SIZE, MAX_TABLE_SIZE);
50
51
0
  headers->destroy();
52
53
0
  return 0;
54
0
}