blob: 231e757c8b26a7d6aca9ec09f517e19f09b92085 [file] [log] [blame]
Kostya Serebryanyf3424592015-05-22 22:35:31 +00001//===- FuzzerInterface.cpp - Mutate a test input --------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9// Parts of public interface for libFuzzer.
10//===----------------------------------------------------------------------===//
11
12
13#include "FuzzerInterface.h"
14#include "FuzzerInternal.h"
15
16namespace fuzzer {
Kostya Serebryany404c69f2015-07-24 01:06:40 +000017
18void FuzzerRandomLibc::ResetSeed(int seed) { srand(seed); }
19
20size_t FuzzerRandomLibc::Rand() { return rand(); }
21
22UserSuppliedFuzzer::UserSuppliedFuzzer()
Kostya Serebryanyec2dcb12015-09-03 21:24:19 +000023 : OwnRand(true), Rand(new FuzzerRandomLibc(0)), MD(*Rand) {}
Kostya Serebryany404c69f2015-07-24 01:06:40 +000024
Kostya Serebryanyec2dcb12015-09-03 21:24:19 +000025UserSuppliedFuzzer::UserSuppliedFuzzer(FuzzerRandomBase *Rand)
26 : Rand(Rand), MD(*Rand) {}
Kostya Serebryany404c69f2015-07-24 01:06:40 +000027
28UserSuppliedFuzzer::~UserSuppliedFuzzer() {
29 if (OwnRand)
30 delete Rand;
31}
32
Kostya Serebryanyf3424592015-05-22 22:35:31 +000033} // namespace fuzzer.