mirror of
https://github.com/espressif/openthread.git
synced 2026-10-02 05:47:40 +00:00
[fuzz] process pending tasklets to increase coverage (#3617)
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
#include <openthread/instance.h>
|
#include <openthread/instance.h>
|
||||||
#include <openthread/ip6.h>
|
#include <openthread/ip6.h>
|
||||||
#include <openthread/link.h>
|
#include <openthread/link.h>
|
||||||
|
#include <openthread/tasklet.h>
|
||||||
#include <openthread/thread.h>
|
#include <openthread/thread.h>
|
||||||
#include <openthread/thread_ftd.h>
|
#include <openthread/thread_ftd.h>
|
||||||
#include <openthread/platform/uart.h>
|
#include <openthread/platform/uart.h>
|
||||||
@@ -65,6 +66,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
|
|
||||||
otPlatUartReceived(buf, (uint16_t)size);
|
otPlatUartReceived(buf, (uint16_t)size);
|
||||||
|
|
||||||
|
while (otTaskletsArePending(instance))
|
||||||
|
{
|
||||||
|
otTaskletsProcess(instance);
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <openthread/ip6.h>
|
#include <openthread/ip6.h>
|
||||||
#include <openthread/link.h>
|
#include <openthread/link.h>
|
||||||
#include <openthread/message.h>
|
#include <openthread/message.h>
|
||||||
|
#include <openthread/tasklet.h>
|
||||||
#include <openthread/thread.h>
|
#include <openthread/thread.h>
|
||||||
#include <openthread/thread_ftd.h>
|
#include <openthread/thread_ftd.h>
|
||||||
|
|
||||||
@@ -71,6 +72,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
|
|
||||||
message = NULL;
|
message = NULL;
|
||||||
|
|
||||||
|
while (otTaskletsArePending(instance))
|
||||||
|
{
|
||||||
|
otTaskletsProcess(instance);
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (message != NULL)
|
if (message != NULL)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <openthread/ip6.h>
|
#include <openthread/ip6.h>
|
||||||
#include <openthread/link.h>
|
#include <openthread/link.h>
|
||||||
#include <openthread/ncp.h>
|
#include <openthread/ncp.h>
|
||||||
|
#include <openthread/tasklet.h>
|
||||||
#include <openthread/thread.h>
|
#include <openthread/thread.h>
|
||||||
#include <openthread/thread_ftd.h>
|
#include <openthread/thread_ftd.h>
|
||||||
#include <openthread/platform/uart.h>
|
#include <openthread/platform/uart.h>
|
||||||
@@ -65,6 +66,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
|
|
||||||
otPlatUartReceived(buf, (uint16_t)size);
|
otPlatUartReceived(buf, (uint16_t)size);
|
||||||
|
|
||||||
|
while (otTaskletsArePending(instance))
|
||||||
|
{
|
||||||
|
otTaskletsProcess(instance);
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <openthread/instance.h>
|
#include <openthread/instance.h>
|
||||||
#include <openthread/ip6.h>
|
#include <openthread/ip6.h>
|
||||||
#include <openthread/link.h>
|
#include <openthread/link.h>
|
||||||
|
#include <openthread/tasklet.h>
|
||||||
#include <openthread/thread.h>
|
#include <openthread/thread.h>
|
||||||
#include <openthread/thread_ftd.h>
|
#include <openthread/thread_ftd.h>
|
||||||
#include <openthread/platform/radio.h>
|
#include <openthread/platform/radio.h>
|
||||||
@@ -69,6 +70,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
|
|
||||||
otPlatRadioReceiveDone(instance, &frame, OT_ERROR_NONE);
|
otPlatRadioReceiveDone(instance, &frame, OT_ERROR_NONE);
|
||||||
|
|
||||||
|
while (otTaskletsArePending(instance))
|
||||||
|
{
|
||||||
|
otTaskletsProcess(instance);
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user