Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
pistache
Commits
07b7be79
Unverified
Commit
07b7be79
authored
May 19, 2021
by
davkor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds oss-fuzz setup.
parent
31c2a2c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
0 deletions
+73
-0
CMakeLists.txt
CMakeLists.txt
+5
-0
tests/fuzzers/CMakeLists.txt
tests/fuzzers/CMakeLists.txt
+3
-0
tests/fuzzers/fuzz_parsers.cpp
tests/fuzzers/fuzz_parsers.cpp
+65
-0
No files found.
CMakeLists.txt
View file @
07b7be79
...
...
@@ -20,6 +20,7 @@ option(PISTACHE_BUILD_TESTS "build tests alongside the project" OFF)
option
(
PISTACHE_ENABLE_NETWORK_TESTS
"if tests are built, run ones needing network access"
ON
)
option
(
PISTACHE_USE_SSL
"add support for SSL server"
OFF
)
option
(
PISTACHE_PIC
"Enable pistache PIC"
ON
)
option
(
PISTACHE_BUILD_FUZZ
"Build fuzzer for oss-fuzz"
OFF
)
# require fat LTO objects in static library
if
(
CMAKE_INTERPROCEDURAL_OPTIMIZATION OR CMAKE_CXX_FLAGS MATCHES
"-flto"
OR CMAKE_CXX_FLAGS MATCHES
"-flto=thin"
)
...
...
@@ -105,6 +106,10 @@ if (PISTACHE_BUILD_TESTS)
add_subdirectory
(
tests
)
endif
()
if
(
PISTACHE_BUILD_FUZZ
)
add_subdirectory
(
tests/fuzzers
)
endif
()
# format target
add_custom_target
(
format
...
...
tests/fuzzers/CMakeLists.txt
0 → 100644
View file @
07b7be79
add_executable
(
fuzz_parser fuzz_parser.cpp
)
target_link_libraries
(
fuzz_parser pistache_static
)
set_target_properties
(
fuzz_parser PROPERTIES LINK_FLAGS $ENV{LIB_FUZZING_ENGINE}
)
tests/fuzzers/fuzz_parsers.cpp
0 → 100644
View file @
07b7be79
#include <pistache/http.h>
using
namespace
Pistache
;
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
)
{
std
::
string
input
(
reinterpret_cast
<
const
char
*>
(
data
),
size
);
// URI parsing
Http
::
Uri
::
Query
query1
;
query1
.
add
(
input
,
input
);
// HTTP parsing
Pistache
::
Http
::
Header
::
CacheControl
cc1
;
try
{
cc1
.
parse
(
input
);
}
catch
(...)
{}
Pistache
::
Http
::
Header
::
Accept
a1
;
try
{
a1
.
parse
(
input
);
}
catch
(...)
{}
Pistache
::
Http
::
Header
::
Accept
a2
;
try
{
a2
.
parse
(
input
);
}
catch
(...)
{}
Pistache
::
Http
::
Header
::
Authorization
au
;
try
{
au
.
parse
(
input
);
}
catch
(...)
{}
Pistache
::
Http
::
Header
::
Expect
e
;
try
{
e
.
parse
(
input
);
}
catch
(...)
{}
Pistache
::
Http
::
Header
::
Connection
connection
;
try
{
connection
.
parse
(
input
);
}
catch
(...)
{}
Pistache
::
Http
::
Header
::
Date
d
;
try
{
d
.
parse
(
input
);
}
catch
(...)
{}
Pistache
::
Http
::
Header
::
Host
h
;
try
{
h
.
parse
(
input
);
}
catch
(...)
{}
Pistache
::
Http
::
Header
::
ContentEncoding
ce
;
try
{
ce
.
parse
(
input
);
}
catch
(...)
{}
Pistache
::
Http
::
Header
::
ContentType
ct
;
try
{
ct
.
parse
(
input
);
}
catch
(...)
{}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment