forked from Project-OSRM/osrm-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fuzz testing drivers for json escaping and uri decoding
- Loading branch information
1 parent
4b7ddb6
commit cdf6bab
Showing
3 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "util/string_util.hpp" | ||
|
||
#include "util.hpp" | ||
|
||
#include <iterator> | ||
#include <string> | ||
|
||
using osrm::util::escape_JSON; | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) | ||
{ | ||
const std::string in(reinterpret_cast<const char *>(data), size); | ||
|
||
const auto escaped = escape_JSON(in); | ||
escape(escaped.data()); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "server/api/url_parser.hpp" | ||
#include "util/string_util.hpp" | ||
|
||
#include "util.hpp" | ||
|
||
#include <iterator> | ||
#include <string> | ||
|
||
using osrm::util::URIDecode; | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) | ||
{ | ||
const std::string in(reinterpret_cast<const char *>(data), size); | ||
std::string out; | ||
|
||
(void)URIDecode(in, out); | ||
|
||
escape(out.data()); | ||
|
||
return 0; | ||
} |