示例#1
0
void Fuzzer::ExecuteCallback(const uint8_t *Data, size_t Size) {
  // We copy the contents of Unit into a separate heap buffer
  // so that we reliably find buffer overflows in it.
  std::unique_ptr<uint8_t[]> DataCopy(new uint8_t[Size]);
  memcpy(DataCopy.get(), Data, Size);
  AssignTaintLabels(DataCopy.get(), Size);
  CurrentUnitData = DataCopy.get();
  CurrentUnitSize = Size;
  int Res = CB(DataCopy.get(), Size);
  (void)Res;
  assert(Res == 0);
  CurrentUnitData = nullptr;
  CurrentUnitSize = 0;
}
示例#2
0
void Fuzzer::ExecuteCallback(const uint8_t *Data, size_t Size) {
  UnitStartTime = system_clock::now();
  // We copy the contents of Unit into a separate heap buffer
  // so that we reliably find buffer overflows in it.
  std::unique_ptr<uint8_t[]> DataCopy(new uint8_t[Size]);
  memcpy(DataCopy.get(), Data, Size);
  AssignTaintLabels(DataCopy.get(), Size);
  CurrentUnitData = DataCopy.get();
  CurrentUnitSize = Size;
  AllocTracer.Start();
  int Res = CB(DataCopy.get(), Size);
  (void)Res;
  HasMoreMallocsThanFrees = AllocTracer.Stop();
  CurrentUnitSize = 0;
  CurrentUnitData = nullptr;
  assert(Res == 0);
}