[fuzz] advance alarm time to cover timer handlers (#3753)

This commit is contained in:
Jonathan Hui
2019-04-11 11:59:20 -07:00
committed by GitHub
parent b1ac8a4f19
commit b7b085c9f9
3 changed files with 30 additions and 6 deletions
+10 -2
View File
@@ -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:
+10 -2
View File
@@ -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:
+10 -2
View File
@@ -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: