Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
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
json
Commits
6e879191
Commit
6e879191
authored
Dec 22, 2016
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚧
added fuzzer from OSS-Fuzz
parent
69ed19e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
test/fuzz_test/parse_fuzzer.cc
test/fuzz_test/parse_fuzzer.cc
+36
-0
No files found.
test/fuzz_test/parse_fuzzer.cc
0 → 100644
View file @
6e879191
// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <iostream>
#include <sstream>
#include <json.hpp>
using
json
=
nlohmann
::
json
;
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
)
{
try
{
std
::
stringstream
s
;
s
<<
json
::
parse
(
data
,
data
+
size
);
try
{
auto
j
=
json
::
parse
(
s
.
str
());
std
::
stringstream
s2
;
s2
<<
j
;
assert
(
s
.
str
()
==
s2
.
str
());
assert
(
j
==
json
::
parse
(
s
.
str
()));
}
catch
(
const
std
::
invalid_argument
&
)
{
assert
(
0
);
}
}
catch
(
const
std
::
invalid_argument
&
)
{
}
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