Compare commits

...

3 Commits

Author SHA1 Message Date
Shivam7-1
dfc87f4f15
Merge 63a74a92a8 into 01d3ab127f 2025-01-20 01:53:13 +01:00
Shivam7-1
63a74a92a8
Rename fuzzing_target.cc to fuzzing_target.c 2024-12-22 21:10:58 +05:30
Shivam7-1
8d3cadc52e
initial fuzzing support 2024-12-21 17:04:07 +05:30

24
fuzz/fuzzing_target.c Normal file
View File

@ -0,0 +1,24 @@
#include "clay.h"
#include <stdint.h>
#include <stddef.h>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size < sizeof(Clay_String)) return 0;
Clay_String testString = { .length = size, .chars = (const char *)data };
Clay_Dimensions dimensions = MeasureText(&testString, NULL);
// Call other critical functions
Clay_Arena arena = Clay_CreateArenaWithCapacityAndMemory(1024, (void*)data);
Clay_Initialize(arena, (Clay_Dimensions){1024, 768});
Clay_SetPointerState((Clay_Vector2){0, 0}, false);
Clay_BeginLayout();
Clay_EndLayout();
// Handle pointer state changes
Clay_SetPointerState((Clay_Vector2){1, 1}, true);
Clay_SetPointerState((Clay_Vector2){2, 2}, false);
return 0;
}