summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerMutate.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2016-08-17 21:50:54 +0000
committerKostya Serebryany <kcc@google.com>2016-08-17 21:50:54 +0000
commite72774dd69f98b70603f9748e0d77f5197d97a09 (patch)
tree756682c1da6ae403c0340e92e77f402e26d1c703 /llvm/lib/Fuzzer/FuzzerMutate.cpp
parent432ba9d89a0dfdeedc96a39cb302d9517ab6f559 (diff)
downloadbcm5719-llvm-e72774dd69f98b70603f9748e0d77f5197d97a09.tar.gz
bcm5719-llvm-e72774dd69f98b70603f9748e0d77f5197d97a09.zip
[libFuzzer] given 0 and 255 more preference when inserting repeated bytes
llvm-svn: 278986
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerMutate.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerMutate.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerMutate.cpp b/llvm/lib/Fuzzer/FuzzerMutate.cpp
index e7efe6a6e0a..21df1184e98 100644
--- a/llvm/lib/Fuzzer/FuzzerMutate.cpp
+++ b/llvm/lib/Fuzzer/FuzzerMutate.cpp
@@ -129,7 +129,8 @@ size_t MutationDispatcher::Mutate_InsertRepeatedBytes(uint8_t *Data,
size_t Idx = Rand(Size + 1);
// Insert new values at Data[Idx].
memmove(Data + Idx + N, Data + Idx, Size - Idx);
- uint8_t Byte = RandCh(Rand);
+ // Give preference to 0x00 and 0xff.
+ uint8_t Byte = Rand.RandBool() ? Rand(256) : (Rand.RandBool() ? 0 : 255);
for (size_t i = 0; i < N; i++)
Data[Idx + i] = Byte;
return Size + N;
OpenPOWER on IntegriCloud