Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
test
core
util
fuzzer_util.cc
Go to the documentation of this file.
1
/*
2
*
3
* Copyright 2018 gRPC authors.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*/
18
19
#include "
test/core/util/fuzzer_util.h
"
20
21
#include <algorithm>
22
23
#include <
grpc/support/alloc.h
>
24
25
#include "
src/core/lib/gpr/useful.h
"
26
27
namespace
grpc_core
{
28
namespace
testing
{
29
30
uint8_t
grpc_fuzzer_get_next_byte
(
input_stream
*
inp
) {
31
if
(
inp
->cur ==
inp
->end) {
32
return
0;
33
}
34
return
*
inp
->cur++;
35
}
36
37
char
*
grpc_fuzzer_get_next_string
(
input_stream
*
inp
,
bool
* special) {
38
char
*
str
=
nullptr
;
39
size_t
cap = 0;
40
size_t
sz = 0;
41
char
c;
42
do
{
43
if
(cap == sz) {
44
cap =
std::max
(3 * cap / 2, cap + 8);
45
str
=
static_cast<
char
*
>
(
gpr_realloc
(
str
, cap));
46
}
47
c =
static_cast<
char
>
(
grpc_fuzzer_get_next_byte
(
inp
));
48
str
[sz++] = c;
49
}
while
(c != 0 && c != 1);
50
if
(special !=
nullptr
) {
51
*special = (c == 1);
52
}
53
if
(c == 1) {
54
str
[sz - 1] = 0;
55
}
56
return
str
;
57
}
58
59
uint32_t
grpc_fuzzer_get_next_uint32
(
input_stream
*
inp
) {
60
uint8_t
b
=
grpc_fuzzer_get_next_byte
(
inp
);
61
uint32_t
x
=
b
& 0x7f;
62
if
(
b
& 0x80) {
63
x
<<= 7;
64
b
=
grpc_fuzzer_get_next_byte
(
inp
);
65
x
|=
b
& 0x7f;
66
if
(
b
& 0x80) {
67
x
<<= 7;
68
b
=
grpc_fuzzer_get_next_byte
(
inp
);
69
x
|=
b
& 0x7f;
70
if
(
b
& 0x80) {
71
x
<<= 7;
72
b
=
grpc_fuzzer_get_next_byte
(
inp
);
73
x
|=
b
& 0x7f;
74
if
(
b
& 0x80) {
75
x
= (
x
<< 4) | (
grpc_fuzzer_get_next_byte
(
inp
) & 0x0f);
76
}
77
}
78
}
79
}
80
return
x
;
81
}
82
83
}
// namespace testing
84
}
// namespace grpc_core
xds_interop_client.str
str
Definition:
xds_interop_client.py:487
testing
Definition:
aws_request_signer_test.cc:25
grpc_core::testing::grpc_fuzzer_get_next_string
char * grpc_fuzzer_get_next_string(input_stream *inp, bool *special)
Definition:
fuzzer_util.cc:37
fuzzer_util.h
regen-readme.inp
inp
Definition:
regen-readme.py:11
grpc_core
Definition:
call_metric_recorder.h:31
useful.h
uint8_t
unsigned char uint8_t
Definition:
stdint-msvc2008.h:78
uint32_t
unsigned int uint32_t
Definition:
stdint-msvc2008.h:80
gpr_realloc
GPRAPI void * gpr_realloc(void *p, size_t size)
Definition:
alloc.cc:56
max
int max
Definition:
bloaty/third_party/zlib/examples/enough.c:170
x
int x
Definition:
bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
b
uint64_t b
Definition:
abseil-cpp/absl/container/internal/layout_test.cc:53
grpc_core::testing::input_stream
Definition:
fuzzer_util.h:31
grpc_core::testing::grpc_fuzzer_get_next_byte
uint8_t grpc_fuzzer_get_next_byte(input_stream *inp)
Definition:
fuzzer_util.cc:30
alloc.h
grpc_core::testing::grpc_fuzzer_get_next_uint32
uint32_t grpc_fuzzer_get_next_uint32(input_stream *inp)
Definition:
fuzzer_util.cc:59
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:23