mirror of
https://github.com/nicbarker/clay.git
synced 2025-05-16 15:28:03 +00:00
Compare commits
4 Commits
44675e12a7
...
68333f77df
Author | SHA1 | Date | |
---|---|---|---|
|
68333f77df | ||
|
5571c00a21 | ||
|
63a74a92a8 | ||
|
8d3cadc52e |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4
clay.h
4
clay.h
@ -780,7 +780,7 @@ CLAY_DLL_EXPORT uint32_t Clay_MinMemorySize(void);
|
||||
// Intended to be used with Clay_MinMemorySize in the following way:
|
||||
// uint32_t minMemoryRequired = Clay_MinMemorySize();
|
||||
// Clay_Arena clayMemory = Clay_CreateArenaWithCapacityAndMemory(minMemoryRequired, malloc(minMemoryRequired));
|
||||
CLAY_DLL_EXPORT Clay_Arena Clay_CreateArenaWithCapacityAndMemory(uint32_t capacity, void *memory);
|
||||
CLAY_DLL_EXPORT Clay_Arena Clay_CreateArenaWithCapacityAndMemory(size_t capacity, void *memory);
|
||||
// Sets the state of the "pointer" (i.e. the mouse or touch) in Clay's internal data. Used for detecting and responding to mouse events in the debug view,
|
||||
// as well as for Clay_Hovered() and scroll element handling.
|
||||
CLAY_DLL_EXPORT void Clay_SetPointerState(Clay_Vector2 position, bool pointerDown);
|
||||
@ -3605,7 +3605,7 @@ uint32_t Clay_MinMemorySize(void) {
|
||||
}
|
||||
|
||||
CLAY_WASM_EXPORT("Clay_CreateArenaWithCapacityAndMemory")
|
||||
Clay_Arena Clay_CreateArenaWithCapacityAndMemory(uint32_t capacity, void *memory) {
|
||||
Clay_Arena Clay_CreateArenaWithCapacityAndMemory(size_t capacity, void *memory) {
|
||||
Clay_Arena arena = {
|
||||
.capacity = capacity,
|
||||
.memory = (char *)memory
|
||||
|
Binary file not shown.
24
fuzz/fuzzing_target.c
Normal file
24
fuzz/fuzzing_target.c
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user