mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:12:57 +01:00
sock_async_event: Implement termination condition for fuzzing
See: 65c7bbf76d
.
This commit is contained in:
parent
729e0f95ac
commit
3314388417
@ -93,7 +93,7 @@ ssize_t gnrc_sock_recv(gnrc_sock_reg_t *reg, gnrc_pktsnip_t **pkt_out,
|
||||
gnrc_pktsnip_t *pkt, *netif;
|
||||
msg_t msg;
|
||||
|
||||
#ifdef MODULE_FUZZING
|
||||
#if defined(MODULE_FUZZING) && !defined(MODULE_SOCK_ASYNC_EVENT)
|
||||
if (gnrc_sock_prevpkt && gnrc_sock_prevpkt == gnrc_pktbuf_fuzzptr) {
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
@ -16,6 +16,11 @@
|
||||
#include "irq.h"
|
||||
#include "net/sock/async/event.h"
|
||||
|
||||
#ifdef MODULE_FUZZING
|
||||
extern gnrc_pktsnip_t *gnrc_pktbuf_fuzzptr;
|
||||
extern gnrc_pktsnip_t *gnrc_sock_prevpkt;
|
||||
#endif
|
||||
|
||||
static void _event_handler(event_t *ev)
|
||||
{
|
||||
sock_event_t *event = (sock_event_t *)ev;
|
||||
@ -36,6 +41,12 @@ static inline void _cb(void *sock, sock_async_flags_t type, void *arg,
|
||||
ctx->event.cb_arg = arg;
|
||||
ctx->event.type |= type;
|
||||
event_post(ctx->queue, &ctx->event.super);
|
||||
|
||||
#ifdef MODULE_FUZZING
|
||||
if (gnrc_sock_prevpkt && gnrc_sock_prevpkt == gnrc_pktbuf_fuzzptr) {
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void _set_ctx(sock_async_ctx_t *ctx, event_queue_t *ev_queue)
|
||||
|
Loading…
Reference in New Issue
Block a user