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
c8a6ce79
Unverified
Commit
c8a6ce79
authored
Mar 08, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚑
fixing fuzzers to work with new exceptions
parent
fc9b528e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
18 deletions
+8
-18
test/src/fuzzer-parse_cbor.cpp
test/src/fuzzer-parse_cbor.cpp
+4
-8
test/src/fuzzer-parse_msgpack.cpp
test/src/fuzzer-parse_msgpack.cpp
+4
-8
test/src/unit-cbor.cpp
test/src/unit-cbor.cpp
+0
-2
No files found.
test/src/fuzzer-parse_cbor.cpp
View file @
c8a6ce79
...
...
@@ -44,23 +44,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
// deserializations must match
assert
(
j1
==
j2
);
}
catch
(
const
std
::
invalid_argument
&
)
catch
(
const
json
::
parse_error
&
)
{
// parsing a CBOR serialization must not fail
assert
(
false
);
}
}
catch
(
const
std
::
invalid_argument
&
)
catch
(
const
json
::
parse_error
&
)
{
// parse errors are ok, because input may be random bytes
}
catch
(
const
std
::
out_of_range
&
)
catch
(
const
json
::
type_error
&
)
{
// parse errors are ok, because input may be random bytes
}
catch
(
const
std
::
domain_error
&
)
{
// parse errors are ok, because input may be random bytes
// type errors can occur during parsing, too
}
// return 0 - non-zero return values are reserved for future use
...
...
test/src/fuzzer-parse_msgpack.cpp
View file @
c8a6ce79
...
...
@@ -44,23 +44,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
// deserializations must match
assert
(
j1
==
j2
);
}
catch
(
const
std
::
invalid_argument
&
)
catch
(
const
json
::
parse_error
&
)
{
// parsing a MessagePack serialization must not fail
assert
(
false
);
}
}
catch
(
const
std
::
invalid_argument
&
)
catch
(
const
json
::
parse_error
&
)
{
// parse errors are ok, because input may be random bytes
}
catch
(
const
std
::
out_of_range
&
)
catch
(
const
json
::
type_error
&
)
{
// parse errors are ok, because input may be random bytes
}
catch
(
const
std
::
domain_error
&
)
{
// parse errors are ok, because input may be random bytes
// type errors can occur during parsing, too
}
// return 0 - non-zero return values are reserved for future use
...
...
test/src/unit-cbor.cpp
View file @
c8a6ce79
...
...
@@ -1358,8 +1358,6 @@ TEST_CASE("CBOR regressions", "[!throws]")
{
// exotic edge case
CHECK_THROWS_AS
(
json
::
check_length
(
0xffffffffffffffffull
,
0xfffffffffffffff0ull
,
0xff
),
json
::
parse_error
);
CHECK_THROWS_WITH
(
json
::
check_length
(
0xffffffffffffffffull
,
0xfffffffffffffff0ull
,
0xff
),
"[json.exception.parse_error.110] parse error at 256: cannot read 18446744073709551600 bytes from vector"
);
}
}
...
...
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