[libc-commits] [libc] [libc] add hashtable fuzzing (PR #87949)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Fri Apr 19 16:59:59 PDT 2024


================
@@ -0,0 +1,159 @@
+#include "src/__support/CPP/new.h"
+#include "src/__support/CPP/optional.h"
+#include "src/__support/HashTable/table.h"
+#include "src/string/memcpy.h"
+#include <search.h>
+#include <stdint.h>
+namespace LIBC_NAMESPACE {
+
+enum class Action { Find, Insert, CrossCheck };
+static uint8_t *global_buffer = nullptr;
----------------
michaelrj-google wrote:

look at the implementation of strtofloat_fuzz. There we allocate a new buffer inside of the function so we can add a null terminator and do other string modifications. It doesn't need to be global, it just needs to live as long as the function call.

https://github.com/llvm/llvm-project/pull/87949


More information about the libc-commits mailing list