mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 09:57:47 +00:00
[fuzz] advance alarm time to cover timer handlers (#3753)
This commit is contained in:
+10
-2
@@ -26,6 +26,8 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define MAX_ITERATIONS 100
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <openthread/instance.h>
|
||||
@@ -39,6 +41,7 @@
|
||||
#include "common/code_utils.hpp"
|
||||
|
||||
extern "C" void FuzzerPlatformInit(void);
|
||||
extern "C" void FuzzerPlatformProcess(otInstance *aInstance);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
@@ -72,9 +75,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
|
||||
message = NULL;
|
||||
|
||||
while (otTaskletsArePending(instance))
|
||||
for (int i = 0; i < MAX_ITERATIONS; i++)
|
||||
{
|
||||
otTaskletsProcess(instance);
|
||||
while (otTaskletsArePending(instance))
|
||||
{
|
||||
otTaskletsProcess(instance);
|
||||
}
|
||||
|
||||
FuzzerPlatformProcess(instance);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define MAX_ITERATIONS 100
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -41,6 +43,7 @@
|
||||
#include "common/code_utils.hpp"
|
||||
|
||||
extern "C" void FuzzerPlatformInit(void);
|
||||
extern "C" void FuzzerPlatformProcess(otInstance *aInstance);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
@@ -66,9 +69,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
|
||||
otPlatUartReceived(buf, (uint16_t)size);
|
||||
|
||||
while (otTaskletsArePending(instance))
|
||||
for (int i = 0; i < MAX_ITERATIONS; i++)
|
||||
{
|
||||
otTaskletsProcess(instance);
|
||||
while (otTaskletsArePending(instance))
|
||||
{
|
||||
otTaskletsProcess(instance);
|
||||
}
|
||||
|
||||
FuzzerPlatformProcess(instance);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define MAX_ITERATIONS 100
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -40,6 +42,7 @@
|
||||
#include "common/code_utils.hpp"
|
||||
|
||||
extern "C" void FuzzerPlatformInit(void);
|
||||
extern "C" void FuzzerPlatformProcess(otInstance *aInstance);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
@@ -70,9 +73,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
|
||||
otPlatRadioReceiveDone(instance, &frame, OT_ERROR_NONE);
|
||||
|
||||
while (otTaskletsArePending(instance))
|
||||
for (int i = 0; i < MAX_ITERATIONS; i++)
|
||||
{
|
||||
otTaskletsProcess(instance);
|
||||
while (otTaskletsArePending(instance))
|
||||
{
|
||||
otTaskletsProcess(instance);
|
||||
}
|
||||
|
||||
FuzzerPlatformProcess(instance);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
Reference in New Issue
Block a user