mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-05 06:57:00 +02:00
Added undefined behavior sanitizer.
Combined common sanitizer flags. Added fuzzers.
This commit is contained in:
parent
5022a9c610
commit
5f6bbd3eb9
23 changed files with 813 additions and 4 deletions
33
fuzzing/fuzzing_throttle.cc
Normal file
33
fuzzing/fuzzing_throttle.cc
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
#include <thread>
|
||||
|
||||
#include "fuzzing.h"
|
||||
|
||||
|
||||
static unsigned int counter = 0;
|
||||
|
||||
|
||||
void
|
||||
fuzzing_tick(void)
|
||||
{
|
||||
counter++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fuzzing_throttle(void)
|
||||
{
|
||||
unsigned int delay;
|
||||
|
||||
|
||||
// Give queues time to drain (avoid OOM or crash)
|
||||
// - Too high a delay slows down fuzzing
|
||||
// - Too low a delay causes intermittent crash on exit
|
||||
delay = 50 + (counter / 50);
|
||||
counter = 0;
|
||||
|
||||
if(delay > 5000)
|
||||
delay = 5000;
|
||||
|
||||
std::this_thread::sleep_for (std::chrono::milliseconds(delay));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue