diff --git a/.whitesource b/.whitesource
new file mode 100644
index 000000000..e0aaa3e9e
--- /dev/null
+++ b/.whitesource
@@ -0,0 +1,8 @@
+{
+ "checkRunSettings": {
+ "vulnerableCheckRunConclusionLevel": "failure"
+ },
+ "issueSettings": {
+ "minSeverityLevel": "LOW"
+ }
+}
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d4ed1e89c..5009fea41 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1)
## PROJECT
## name and version
##
-project(nlohmann_json VERSION 3.7.1 LANGUAGES CXX)
+project(nlohmann_json VERSION 3.7.2 LANGUAGES CXX)
##
## INCLUDE
diff --git a/ChangeLog.md b/ChangeLog.md
index dea79cae1..ba6e5e284 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,6 +1,22 @@
# Change Log
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
+## [v3.7.2](https://github.com/nlohmann/json/releases/tag/v3.7.2) (2019-11-10)
+[Full Changelog](https://github.com/nlohmann/json/compare/v3.7.1...v3.7.2)
+
+- Segmentation fault in destructor in case of large inputs [\#1835](https://github.com/nlohmann/json/issues/1835)
+- type\_name\(\) is not consistent with type\(\) [\#1833](https://github.com/nlohmann/json/issues/1833)
+- json::parse is not a member [\#1832](https://github.com/nlohmann/json/issues/1832)
+- How do you deal with json\* ? [\#1829](https://github.com/nlohmann/json/issues/1829)
+- Combined find\_package/add\_subdirectory not linking libraries [\#1771](https://github.com/nlohmann/json/issues/1771)
+- example code for ifstream reading a json file results in no operator error [\#1766](https://github.com/nlohmann/json/issues/1766)
+- Warning: unsequenced modification and access to 'range' [\#1674](https://github.com/nlohmann/json/issues/1674)
+- Segmentation fault \(stack overflow\) due to unbounded recursion [\#1419](https://github.com/nlohmann/json/issues/1419)
+- Stack-overflow \(OSS-Fuzz 4234\) [\#832](https://github.com/nlohmann/json/issues/832)
+
+- Configure WhiteSource Bolt for GitHub [\#1830](https://github.com/nlohmann/json/pull/1830) ([whitesource-bolt-for-github[bot]](https://github.com/apps/whitesource-bolt-for-github))
+- Prevent stackoverflow caused by recursive deconstruction [\#1436](https://github.com/nlohmann/json/pull/1436) ([nickaein](https://github.com/nickaein))
+
## [v3.7.1](https://github.com/nlohmann/json/releases/tag/v3.7.1) (2019-11-06)
[Full Changelog](https://github.com/nlohmann/json/compare/v3.7.0...v3.7.1)
@@ -350,7 +366,6 @@ All notable changes to this project will be documented in this file. This projec
- Which version can be used with GCC 4.8.2 ? [\#1424](https://github.com/nlohmann/json/issues/1424)
- Ignore nullptr values on constructing json object from a container [\#1422](https://github.com/nlohmann/json/issues/1422)
- Support for custom float precision via unquoted strings [\#1421](https://github.com/nlohmann/json/issues/1421)
-- Segmentation fault \(stack overflow\) due to unbounded recursion [\#1419](https://github.com/nlohmann/json/issues/1419)
- It is possible to call `json::find` with a json\_pointer as argument. This causes runtime UB/crash. [\#1418](https://github.com/nlohmann/json/issues/1418)
- Dump throwing exception [\#1416](https://github.com/nlohmann/json/issues/1416)
- Build error [\#1415](https://github.com/nlohmann/json/issues/1415)
@@ -752,7 +767,6 @@ All notable changes to this project will be documented in this file. This projec
- How to solve large json file? [\#927](https://github.com/nlohmann/json/issues/927)
- json\_pointer public push\_back, pop\_back [\#837](https://github.com/nlohmann/json/issues/837)
- Using input\_adapter in a slightly unexpected way [\#834](https://github.com/nlohmann/json/issues/834)
-- Stack-overflow \(OSS-Fuzz 4234\) [\#832](https://github.com/nlohmann/json/issues/832)
- Fix -Wno-sometimes-uninitialized by initializing "result" in parse\_sax [\#1200](https://github.com/nlohmann/json/pull/1200) ([thyu](https://github.com/thyu))
- \[RFC\] Introduce a new macro function: JSON\_INTERNAL\_CATCH [\#1187](https://github.com/nlohmann/json/pull/1187) ([simnalamburt](https://github.com/simnalamburt))
diff --git a/Makefile b/Makefile
index 9dc8be68c..2641e6107 100644
--- a/Makefile
+++ b/Makefile
@@ -134,7 +134,7 @@ pedantic_clang:
# calling GCC with most warnings
pedantic_gcc:
- $(MAKE) json_unit CXX=g++-9 CXXFLAGS=" \
+ $(MAKE) json_unit CXX=/usr/local/bin/g++-9 CXXFLAGS=" \
-std=c++11 \
-Waddress \
-Waddress-of-packed-member \
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 722797c6e..b4df78cc5 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -5,7 +5,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "JSON for Modern C++"
-PROJECT_NUMBER = 3.7.1
+PROJECT_NUMBER = 3.7.2
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = .
diff --git a/doc/examples/README.link b/doc/examples/README.link
index 9ac2a1dcd..5e86bf74a 100644
--- a/doc/examples/README.link
+++ b/doc/examples/README.link
@@ -1 +1 @@
-online
\ No newline at end of file
+online
\ No newline at end of file
diff --git a/doc/examples/meta.output b/doc/examples/meta.output
index c0e6bf122..63c996721 100644
--- a/doc/examples/meta.output
+++ b/doc/examples/meta.output
@@ -11,7 +11,7 @@
"version": {
"major": 3,
"minor": 7,
- "patch": 1,
- "string": "3.7.1"
+ "patch": 2,
+ "string": "3.7.2"
}
}
diff --git a/doc/index.md b/doc/index.md
index 21759ea26..a590f978c 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -329,4 +329,4 @@ Note that this table only lists those exceptions thrown due to the type. For ins
@author [Niels Lohmann](http://nlohmann.me)
@see https://github.com/nlohmann/json to download the source code
-@version 3.7.1
+@version 3.7.2
diff --git a/doc/json.gif b/doc/json.gif
index 1d2923e30..902fe5cc3 100644
Binary files a/doc/json.gif and b/doc/json.gif differ
diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp
index 23bd3ed49..a0a0f4c17 100644
--- a/include/nlohmann/json.hpp
+++ b/include/nlohmann/json.hpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
@@ -32,7 +32,7 @@ SOFTWARE.
#define NLOHMANN_JSON_VERSION_MAJOR 3
#define NLOHMANN_JSON_VERSION_MINOR 7
-#define NLOHMANN_JSON_VERSION_PATCH 1
+#define NLOHMANN_JSON_VERSION_PATCH 2
#include // all_of, find, for_each
#include // assert
@@ -953,7 +953,7 @@ class basic_json
object = nullptr; // silence warning, see #821
if (JSON_HEDLEY_UNLIKELY(t == value_t::null))
{
- JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.7.1")); // LCOV_EXCL_LINE
+ JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.7.2")); // LCOV_EXCL_LINE
}
break;
}
@@ -998,6 +998,55 @@ class basic_json
void destroy(value_t t) noexcept
{
+ // flatten the current json_value to a heap-allocated stack
+ std::vector stack;
+
+ // move the top-level items to stack
+ if (t == value_t::array)
+ {
+ stack.reserve(array->size());
+ std::move(array->begin(), array->end(), std::back_inserter(stack));
+ }
+ else if (t == value_t::object)
+ {
+ stack.reserve(object->size());
+
+ for (auto&& it : *object)
+ {
+ stack.push_back(std::move(it.second));
+ }
+ }
+
+ while (!stack.empty())
+ {
+ // move the last item to local variable to be processed
+ basic_json current_item(std::move(stack.back()));
+ stack.pop_back();
+
+ // if current_item is array/object, move
+ // its children to the stack to be processed later
+ if (current_item.is_array())
+ {
+ stack.reserve(stack.size() + current_item.m_value.array->size());
+
+ std::move(current_item.m_value.array->begin(), current_item.m_value.array->end(),
+ std::back_inserter(stack));
+
+ current_item.m_value.array->clear();
+ }
+ else if (current_item.is_object())
+ {
+ stack.reserve(stack.size() + current_item.m_value.object->size());
+
+ for (auto&& it : *current_item.m_value.object)
+ {
+ stack.push_back(std::move(it.second));
+ }
+ }
+
+ // current_item is destroyed here
+ }
+
switch (t)
{
case value_t::object:
diff --git a/meson.build b/meson.build
index a615c5f36..66d235282 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('nlohmann_json',
'cpp',
- version : '3.7.1',
+ version : '3.7.2',
license : 'MIT',
)
diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp
index 6430930d0..443459f0c 100644
--- a/single_include/nlohmann/json.hpp
+++ b/single_include/nlohmann/json.hpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
@@ -32,7 +32,7 @@ SOFTWARE.
#define NLOHMANN_JSON_VERSION_MAJOR 3
#define NLOHMANN_JSON_VERSION_MINOR 7
-#define NLOHMANN_JSON_VERSION_PATCH 1
+#define NLOHMANN_JSON_VERSION_PATCH 2
#include // all_of, find, for_each
#include // assert
@@ -15496,7 +15496,7 @@ class basic_json
object = nullptr; // silence warning, see #821
if (JSON_HEDLEY_UNLIKELY(t == value_t::null))
{
- JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.7.1")); // LCOV_EXCL_LINE
+ JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.7.2")); // LCOV_EXCL_LINE
}
break;
}
@@ -15541,6 +15541,55 @@ class basic_json
void destroy(value_t t) noexcept
{
+ // flatten the current json_value to a heap-allocated stack
+ std::vector stack;
+
+ // move the top-level items to stack
+ if (t == value_t::array)
+ {
+ stack.reserve(array->size());
+ std::move(array->begin(), array->end(), std::back_inserter(stack));
+ }
+ else if (t == value_t::object)
+ {
+ stack.reserve(object->size());
+
+ for (auto&& it : *object)
+ {
+ stack.push_back(std::move(it.second));
+ }
+ }
+
+ while (!stack.empty())
+ {
+ // move the last item to local variable to be processed
+ basic_json current_item(std::move(stack.back()));
+ stack.pop_back();
+
+ // if current_item is array/object, move
+ // its children to the stack to be processed later
+ if (current_item.is_array())
+ {
+ stack.reserve(stack.size() + current_item.m_value.array->size());
+
+ std::move(current_item.m_value.array->begin(), current_item.m_value.array->end(),
+ std::back_inserter(stack));
+
+ current_item.m_value.array->clear();
+ }
+ else if (current_item.is_object())
+ {
+ stack.reserve(stack.size() + current_item.m_value.object->size());
+
+ for (auto&& it : *current_item.m_value.object)
+ {
+ stack.push_back(std::move(it.second));
+ }
+ }
+
+ // current_item is destroyed here
+ }
+
switch (t)
{
case value_t::object:
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 762e5582d..df2f055bf 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -127,6 +127,7 @@ set(files
src/unit-iterators2.cpp
src/unit-json_patch.cpp
src/unit-json_pointer.cpp
+ src/unit-large_json.cpp
src/unit-merge_patch.cpp
src/unit-meta.cpp
src/unit-modifiers.cpp
diff --git a/test/src/fuzzer-driver_afl.cpp b/test/src/fuzzer-driver_afl.cpp
index 7f2d645b3..5c678d36f 100644
--- a/test/src/fuzzer-driver_afl.cpp
+++ b/test/src/fuzzer-driver_afl.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (fuzz test support)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
This file implements a driver for American Fuzzy Lop (afl-fuzz). It relies on
diff --git a/test/src/fuzzer-parse_bson.cpp b/test/src/fuzzer-parse_bson.cpp
index a38062e22..9b83892ce 100644
--- a/test/src/fuzzer-parse_bson.cpp
+++ b/test/src/fuzzer-parse_bson.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (fuzz test support)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
This file implements a parser test suitable for fuzz testing. Given a byte
diff --git a/test/src/fuzzer-parse_cbor.cpp b/test/src/fuzzer-parse_cbor.cpp
index 4038bc90d..550b1fc1e 100644
--- a/test/src/fuzzer-parse_cbor.cpp
+++ b/test/src/fuzzer-parse_cbor.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (fuzz test support)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
This file implements a parser test suitable for fuzz testing. Given a byte
diff --git a/test/src/fuzzer-parse_json.cpp b/test/src/fuzzer-parse_json.cpp
index 78179c167..29655b8ae 100644
--- a/test/src/fuzzer-parse_json.cpp
+++ b/test/src/fuzzer-parse_json.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (fuzz test support)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
This file implements a parser test suitable for fuzz testing. Given a byte
diff --git a/test/src/fuzzer-parse_msgpack.cpp b/test/src/fuzzer-parse_msgpack.cpp
index b14cbed93..56c6fc4fc 100644
--- a/test/src/fuzzer-parse_msgpack.cpp
+++ b/test/src/fuzzer-parse_msgpack.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (fuzz test support)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
This file implements a parser test suitable for fuzz testing. Given a byte
diff --git a/test/src/fuzzer-parse_ubjson.cpp b/test/src/fuzzer-parse_ubjson.cpp
index cb43cb928..c46d0aaaa 100644
--- a/test/src/fuzzer-parse_ubjson.cpp
+++ b/test/src/fuzzer-parse_ubjson.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (fuzz test support)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
This file implements a parser test suitable for fuzz testing. Given a byte
diff --git a/test/src/unit-algorithms.cpp b/test/src/unit-algorithms.cpp
index 877734391..caa995a4c 100644
--- a/test/src/unit-algorithms.cpp
+++ b/test/src/unit-algorithms.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-allocator.cpp b/test/src/unit-allocator.cpp
index b643bd6e6..c77c19147 100644
--- a/test/src/unit-allocator.cpp
+++ b/test/src/unit-allocator.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-alt-string.cpp b/test/src/unit-alt-string.cpp
index 68efa6416..d1c6d2a75 100644
--- a/test/src/unit-alt-string.cpp
+++ b/test/src/unit-alt-string.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-bson.cpp b/test/src/unit-bson.cpp
index cbfbf5aca..ad6875aca 100644
--- a/test/src/unit-bson.cpp
+++ b/test/src/unit-bson.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-capacity.cpp b/test/src/unit-capacity.cpp
index 78af48157..a02a3e453 100644
--- a/test/src/unit-capacity.cpp
+++ b/test/src/unit-capacity.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp
index 65fd0ac46..bad2d36eb 100644
--- a/test/src/unit-cbor.cpp
+++ b/test/src/unit-cbor.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-class_const_iterator.cpp b/test/src/unit-class_const_iterator.cpp
index 98f01286b..efe3ab16d 100644
--- a/test/src/unit-class_const_iterator.cpp
+++ b/test/src/unit-class_const_iterator.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-class_iterator.cpp b/test/src/unit-class_iterator.cpp
index f389b814e..d729f8544 100644
--- a/test/src/unit-class_iterator.cpp
+++ b/test/src/unit-class_iterator.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-class_lexer.cpp b/test/src/unit-class_lexer.cpp
index 5b7d6f8ed..d8b8ea624 100644
--- a/test/src/unit-class_lexer.cpp
+++ b/test/src/unit-class_lexer.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-class_parser.cpp b/test/src/unit-class_parser.cpp
index b6f0adc32..3d0893bdc 100644
--- a/test/src/unit-class_parser.cpp
+++ b/test/src/unit-class_parser.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-comparison.cpp b/test/src/unit-comparison.cpp
index ea04a03a4..144e1c0a0 100644
--- a/test/src/unit-comparison.cpp
+++ b/test/src/unit-comparison.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-concepts.cpp b/test/src/unit-concepts.cpp
index dd8433729..fad1b9e4b 100644
--- a/test/src/unit-concepts.cpp
+++ b/test/src/unit-concepts.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-constructor1.cpp b/test/src/unit-constructor1.cpp
index a1d62f917..0d638d9af 100644
--- a/test/src/unit-constructor1.cpp
+++ b/test/src/unit-constructor1.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-constructor2.cpp b/test/src/unit-constructor2.cpp
index 563ebebcb..c8ff0d5ac 100644
--- a/test/src/unit-constructor2.cpp
+++ b/test/src/unit-constructor2.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-convenience.cpp b/test/src/unit-convenience.cpp
index 886ca2da0..97187727e 100644
--- a/test/src/unit-convenience.cpp
+++ b/test/src/unit-convenience.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp
index ced7064ad..a6c59c90a 100644
--- a/test/src/unit-conversions.cpp
+++ b/test/src/unit-conversions.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-deserialization.cpp b/test/src/unit-deserialization.cpp
index 4bc0f35f7..8f3ad7da8 100644
--- a/test/src/unit-deserialization.cpp
+++ b/test/src/unit-deserialization.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-element_access1.cpp b/test/src/unit-element_access1.cpp
index f3d69af4d..5d85a14e1 100644
--- a/test/src/unit-element_access1.cpp
+++ b/test/src/unit-element_access1.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-element_access2.cpp b/test/src/unit-element_access2.cpp
index 32070974f..9994afa8f 100644
--- a/test/src/unit-element_access2.cpp
+++ b/test/src/unit-element_access2.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-inspection.cpp b/test/src/unit-inspection.cpp
index 9fa944d47..758bd82a8 100644
--- a/test/src/unit-inspection.cpp
+++ b/test/src/unit-inspection.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-items.cpp b/test/src/unit-items.cpp
index d5bda1b3d..594304757 100644
--- a/test/src/unit-items.cpp
+++ b/test/src/unit-items.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-iterators1.cpp b/test/src/unit-iterators1.cpp
index 9c9d7205b..03d048eff 100644
--- a/test/src/unit-iterators1.cpp
+++ b/test/src/unit-iterators1.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-iterators2.cpp b/test/src/unit-iterators2.cpp
index 577071e74..ff822a360 100644
--- a/test/src/unit-iterators2.cpp
+++ b/test/src/unit-iterators2.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-json_patch.cpp b/test/src/unit-json_patch.cpp
index 51de2f9a6..43d7a71c0 100644
--- a/test/src/unit-json_patch.cpp
+++ b/test/src/unit-json_patch.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-json_pointer.cpp b/test/src/unit-json_pointer.cpp
index ce18f3423..d14e7b23c 100644
--- a/test/src/unit-json_pointer.cpp
+++ b/test/src/unit-json_pointer.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-large_json.cpp b/test/src/unit-large_json.cpp
new file mode 100644
index 000000000..13f193f44
--- /dev/null
+++ b/test/src/unit-large_json.cpp
@@ -0,0 +1,49 @@
+/*
+ __ _____ _____ _____
+ __| | __| | | | JSON for Modern C++ (test suite)
+| | |__ | | | | | | version 3.7.2
+|_____|_____|_____|_|___| https://github.com/nlohmann/json
+
+Licensed under the MIT License .
+SPDX-License-Identifier: MIT
+Copyright (c) 2013-2019 Niels Lohmann .
+
+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
+using nlohmann::json;
+
+#include
+
+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));
+ }
+}
+
diff --git a/test/src/unit-merge_patch.cpp b/test/src/unit-merge_patch.cpp
index ab3acbeca..28554059b 100644
--- a/test/src/unit-merge_patch.cpp
+++ b/test/src/unit-merge_patch.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-meta.cpp b/test/src/unit-meta.cpp
index 2a1117300..0d3bcb537 100644
--- a/test/src/unit-meta.cpp
+++ b/test/src/unit-meta.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
@@ -43,10 +43,10 @@ TEST_CASE("version information")
CHECK(j["url"] == "https://github.com/nlohmann/json");
CHECK(j["version"] == json(
{
- {"string", "3.7.1"},
+ {"string", "3.7.2"},
{"major", 3},
{"minor", 7},
- {"patch", 1}
+ {"patch", 2}
}));
CHECK(j.find("platform") != j.end());
diff --git a/test/src/unit-modifiers.cpp b/test/src/unit-modifiers.cpp
index 1336c07bc..a9735c598 100644
--- a/test/src/unit-modifiers.cpp
+++ b/test/src/unit-modifiers.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-msgpack.cpp b/test/src/unit-msgpack.cpp
index bcd88f356..f9b8f9e7e 100644
--- a/test/src/unit-msgpack.cpp
+++ b/test/src/unit-msgpack.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-noexcept.cpp b/test/src/unit-noexcept.cpp
index d551bb868..a5350a8e6 100644
--- a/test/src/unit-noexcept.cpp
+++ b/test/src/unit-noexcept.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-pointer_access.cpp b/test/src/unit-pointer_access.cpp
index 0cd4d86a0..04aeca911 100644
--- a/test/src/unit-pointer_access.cpp
+++ b/test/src/unit-pointer_access.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-readme.cpp b/test/src/unit-readme.cpp
index 564493819..68f26fa26 100644
--- a/test/src/unit-readme.cpp
+++ b/test/src/unit-readme.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-reference_access.cpp b/test/src/unit-reference_access.cpp
index f26ab9cf5..da2361ce3 100644
--- a/test/src/unit-reference_access.cpp
+++ b/test/src/unit-reference_access.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp
index f0be31327..d7015c2e8 100644
--- a/test/src/unit-regression.cpp
+++ b/test/src/unit-regression.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-serialization.cpp b/test/src/unit-serialization.cpp
index 9620e3a8b..4058f842d 100644
--- a/test/src/unit-serialization.cpp
+++ b/test/src/unit-serialization.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-testsuites.cpp b/test/src/unit-testsuites.cpp
index 91fd84822..caf58b4db 100644
--- a/test/src/unit-testsuites.cpp
+++ b/test/src/unit-testsuites.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-to_chars.cpp b/test/src/unit-to_chars.cpp
index 6ff5cd106..31863b96c 100644
--- a/test/src/unit-to_chars.cpp
+++ b/test/src/unit-to_chars.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
@@ -359,7 +359,7 @@ TEST_CASE("formatting")
{
auto check_float = [](float number, const std::string & expected)
{
- char buf[32];
+ char buf[33];
char* end = nlohmann::detail::to_chars(buf, buf + 32, number);
std::string actual(buf, end);
@@ -419,7 +419,7 @@ TEST_CASE("formatting")
{
auto check_double = [](double number, const std::string & expected)
{
- char buf[32];
+ char buf[33];
char* end = nlohmann::detail::to_chars(buf, buf + 32, number);
std::string actual(buf, end);
diff --git a/test/src/unit-ubjson.cpp b/test/src/unit-ubjson.cpp
index 753bb4831..3d0555505 100644
--- a/test/src/unit-ubjson.cpp
+++ b/test/src/unit-ubjson.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-udt.cpp b/test/src/unit-udt.cpp
index eea54718b..e6335b7bd 100644
--- a/test/src/unit-udt.cpp
+++ b/test/src/unit-udt.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-unicode.cpp b/test/src/unit-unicode.cpp
index 50d1f2a1d..da3c7de5e 100644
--- a/test/src/unit-unicode.cpp
+++ b/test/src/unit-unicode.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit-wstring.cpp b/test/src/unit-wstring.cpp
index c8dadb29d..475c24d2d 100644
--- a/test/src/unit-wstring.cpp
+++ b/test/src/unit-wstring.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
diff --git a/test/src/unit.cpp b/test/src/unit.cpp
index 3930fc428..f1b022622 100644
--- a/test/src/unit.cpp
+++ b/test/src/unit.cpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++ (test suite)
-| | |__ | | | | | | version 3.7.1
+| | |__ | | | | | | version 3.7.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .