Fuzzers - DeepState_Malloc leaks memory
GrosQuildu opened this issue · 1 comments
GrosQuildu commented
Using DeepState_Malloc
is hard with fuzzers, because it requires free
ing. Now, if we place some ASSERT
s before free
, we will leak memory. Replacing ASSERT
with CHECK
introduces some strange behavior:
- fuzzing with AFL: it leaks memory same as
ASSERT
- fuzzing with libFuzzer: it do not leaks, but also dont crash
Example test:
#include <deepstate/DeepState.hpp>
using namespace deepstate;
TEST(T, T) {
char *data = (char*)DeepState_Malloc(4096);
for (int i = 0; i < 15; ++i)
{
char out[3] = {};
snprintf(out, 3, "%02x", data[i]);
LOG(INFO) << out;
}
printf("\n");
ASSERT_EQ(data[0], 0); // CHECK_EQ(data[0], 0);
free(data);
}