Changeset View
Changeset View
Standalone View
Standalone View
src/test/fuzz/fuzz.cpp
Show All 17 Lines | |||||
#endif | #endif | ||||
#if defined(PROVIDE_MAIN_FUNCTION) | #if defined(PROVIDE_MAIN_FUNCTION) | ||||
static bool read_stdin(std::vector<uint8_t> &data) { | static bool read_stdin(std::vector<uint8_t> &data) { | ||||
uint8_t buffer[1024]; | uint8_t buffer[1024]; | ||||
ssize_t length = 0; | ssize_t length = 0; | ||||
while ((length = read(STDIN_FILENO, buffer, 1024)) > 0) { | while ((length = read(STDIN_FILENO, buffer, 1024)) > 0) { | ||||
data.insert(data.end(), buffer, buffer + length); | data.insert(data.end(), buffer, buffer + length); | ||||
if (data.size() > (1 << 20)) { | |||||
return false; | |||||
} | |||||
} | } | ||||
return length == 0; | return length == 0; | ||||
} | } | ||||
#endif | #endif | ||||
// Default initialization: Override using a non-weak initialize(). | // Default initialization: Override using a non-weak initialize(). | ||||
__attribute__((weak)) void initialize() {} | __attribute__((weak)) void initialize() {} | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |