File: urltest-fuzz.cpp

package info (click to toggle)
pcm 202502-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,164 kB
  • sloc: cpp: 44,347; ansic: 1,161; sh: 778; python: 388; awk: 28; makefile: 13
file content (25 lines) | stat: -rw-r--r-- 631 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#define UNIT_TEST 1

#include "../src/pcm-sensor-server.cpp"

#undef UNIT_TEST


extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
       try
       {
               std::string buf(reinterpret_cast<const char*>(data), size);
               buf.push_back('\0');
               URL x = URL::parse(buf.c_str());
       }
       catch (std::runtime_error & )
       {
               // catch recognized malformed input (thrown as runtime_error in the URL::parse)
               // do not catch any other errors or exceptions to let them be reported
               // by libFuzzer
       }

       return 0;
}