mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
fix: expand asserts in fuzz_support.cc
This commit is contained in:
parent
e1c38b40d6
commit
d222d708b5
|
@ -69,19 +69,19 @@ static constexpr Network_Funcs fuzz_network_funcs = {
|
||||||
/* .listen = */ ![](Fuzz_System *self, int sock, int backlog) { return 0; },
|
/* .listen = */ ![](Fuzz_System *self, int sock, int backlog) { return 0; },
|
||||||
/* .recvbuf = */
|
/* .recvbuf = */
|
||||||
![](Fuzz_System *self, int sock) {
|
![](Fuzz_System *self, int sock) {
|
||||||
assert(sock == 42);
|
assert(sock == 42 || sock == 1337);
|
||||||
const size_t count = random_u16(self->rng.get());
|
const size_t count = random_u16(self->rng.get());
|
||||||
return static_cast<int>(std::min(count, self->data.size));
|
return static_cast<int>(std::min(count, self->data.size));
|
||||||
},
|
},
|
||||||
/* .recv = */
|
/* .recv = */
|
||||||
![](Fuzz_System *self, int sock, uint8_t *buf, size_t len) {
|
![](Fuzz_System *self, int sock, uint8_t *buf, size_t len) {
|
||||||
assert(sock == 42);
|
assert(sock == 42 || sock == 1337);
|
||||||
// Receive data from the fuzzer.
|
// Receive data from the fuzzer.
|
||||||
return recv_common(self->data, buf, len);
|
return recv_common(self->data, buf, len);
|
||||||
},
|
},
|
||||||
/* .recvfrom = */
|
/* .recvfrom = */
|
||||||
![](Fuzz_System *self, int sock, uint8_t *buf, size_t len, Network_Addr *addr) {
|
![](Fuzz_System *self, int sock, uint8_t *buf, size_t len, Network_Addr *addr) {
|
||||||
assert(sock == 42);
|
assert(sock == 42 || sock == 1337);
|
||||||
|
|
||||||
addr->addr = sockaddr_storage{};
|
addr->addr = sockaddr_storage{};
|
||||||
// Dummy Addr
|
// Dummy Addr
|
||||||
|
@ -97,13 +97,13 @@ static constexpr Network_Funcs fuzz_network_funcs = {
|
||||||
},
|
},
|
||||||
/* .send = */
|
/* .send = */
|
||||||
![](Fuzz_System *self, int sock, const uint8_t *buf, size_t len) {
|
![](Fuzz_System *self, int sock, const uint8_t *buf, size_t len) {
|
||||||
assert(sock == 42);
|
assert(sock == 42 || sock == 1337);
|
||||||
// Always succeed.
|
// Always succeed.
|
||||||
return static_cast<int>(len);
|
return static_cast<int>(len);
|
||||||
},
|
},
|
||||||
/* .sendto = */
|
/* .sendto = */
|
||||||
![](Fuzz_System *self, int sock, const uint8_t *buf, size_t len, const Network_Addr *addr) {
|
![](Fuzz_System *self, int sock, const uint8_t *buf, size_t len, const Network_Addr *addr) {
|
||||||
assert(sock == 42);
|
assert(sock == 42 || sock == 1337);
|
||||||
// Always succeed.
|
// Always succeed.
|
||||||
return static_cast<int>(len);
|
return static_cast<int>(len);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user