Skip to content

Commit 4c87431

Browse files
make information more concentrated
1 parent 5a72c4d commit 4c87431

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libc/fuzzing/__support/hashtable_fuzz.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ static cpp::optional<Action> next_action() {
4545

4646
static cpp::optional<char *> next_cstr() {
4747
char *result = reinterpret_cast<char *>(global_buffer);
48-
if (cpp::optional<uint64_t> len = next_uint64()) {
48+
if (cpp::optional<uint8_t> len = next_u8()) {
4949
uint64_t length;
50-
for (length = 0; length < *len % 128; length++) {
50+
for (length = 0; length < *len; length++) {
5151
if (length >= remaining)
5252
return cpp::nullopt;
5353
if (*global_buffer == '\0')
@@ -87,7 +87,7 @@ template <typename Fn> struct CleanUpHook {
8787
#define register_cleanup(ID, ...) \
8888
auto cleanup_hook##ID = __extension__({ \
8989
auto a = __VA_ARGS__; \
90-
CleanUpHook<decltype(a)>{a}; \
90+
CleanUpHook<decltype(a)>(cpp::move(a)); \
9191
});
9292

9393
static void trap_with_message(const char *msg) { __builtin_trap(); }
@@ -103,8 +103,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
103103
memcpy(global_buffer, data, size);
104104

105105
remaining = size;
106-
uint64_t size_a = get_value(next_uint64) % 256;
107-
uint64_t size_b = get_value(next_uint64) % 256;
106+
uint64_t size_a = get_value(next_u8);
107+
uint64_t size_b = get_value(next_u8);
108108
uint64_t rand_a = get_value(next_uint64);
109109
uint64_t rand_b = get_value(next_uint64);
110110
internal::HashTable *table_a = internal::HashTable::allocate(size_a, rand_a);

0 commit comments

Comments
 (0)