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
7e2445a0
Commit
7e2445a0
authored
Nov 09, 2019
by
Isaac Nickaein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move deep JSON test to a separate unit-test
parent
68d0a7b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
10 deletions
+50
-10
test/CMakeLists.txt
test/CMakeLists.txt
+1
-0
test/src/unit-large_json.cpp
test/src/unit-large_json.cpp
+49
-0
test/src/unit-regression.cpp
test/src/unit-regression.cpp
+0
-10
No files found.
test/CMakeLists.txt
View file @
7e2445a0
...
@@ -127,6 +127,7 @@ set(files
...
@@ -127,6 +127,7 @@ set(files
src/unit-iterators2.cpp
src/unit-iterators2.cpp
src/unit-json_patch.cpp
src/unit-json_patch.cpp
src/unit-json_pointer.cpp
src/unit-json_pointer.cpp
src/unit-large_json.cpp
src/unit-merge_patch.cpp
src/unit-merge_patch.cpp
src/unit-meta.cpp
src/unit-meta.cpp
src/unit-modifiers.cpp
src/unit-modifiers.cpp
...
...
test/src/unit-large_json.cpp
0 → 100644
View file @
7e2445a0
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
| | |__ | | | | | | version 3.7.1
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
SPDX-License-Identifier: MIT
Copyright (c) 2013-2019 Niels Lohmann <http://nlohmann.me>.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "doctest_compatibility.h"
#include <nlohmann/json.hpp>
using
nlohmann
::
json
;
#include <algorithm>
TEST_CASE
(
"tests on very large JSONs"
)
{
SECTION
(
"issue #1419 - Segmentation fault (stack overflow) due to unbounded recursion"
)
{
const
auto
depth
=
5000000
;
std
::
string
s
(
2
*
depth
,
'['
);
std
::
fill
(
s
.
begin
()
+
depth
,
s
.
end
(),
']'
);
CHECK_NOTHROW
(
nlohmann
::
json
::
parse
(
s
));
}
}
test/src/unit-regression.cpp
View file @
7e2445a0
...
@@ -1778,16 +1778,6 @@ TEST_CASE("regression tests")
...
@@ -1778,16 +1778,6 @@ TEST_CASE("regression tests")
CHECK
(
expected
==
data
);
CHECK
(
expected
==
data
);
}
}
SECTION
(
"issue #1419 - Segmentation fault (stack overflow) due to unbounded recursion"
)
{
const
auto
depth
=
5000000
;
std
::
string
s
(
2
*
depth
,
'['
);
std
::
fill
(
s
.
begin
()
+
depth
,
s
.
end
(),
']'
);
CHECK_NOTHROW
(
nlohmann
::
json
::
parse
(
s
));
}
SECTION
(
"issue #1445 - buffer overflow in dumping invalid utf-8 strings"
)
SECTION
(
"issue #1445 - buffer overflow in dumping invalid utf-8 strings"
)
{
{
SECTION
(
"a bunch of -1, ensure_ascii=true"
)
SECTION
(
"a bunch of -1, ensure_ascii=true"
)
...
...
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