diff --git a/.whitesource b/.whitesource
new file mode 100644
index 00000000..e0aaa3e9
--- /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 d4ed1e89..5009fea4 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 dea79cae..ba6e5e28 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 9dc8be68..2641e610 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 722797c6..b4df78cc 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 9ac2a1dc..5e86bf74 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 c0e6bf12..63c99672 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 21759ea2..a590f978 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 1d2923e3..902fe5cc 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 23bd3ed4..a0a0f4c1 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 a615c5f3..66d23528 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 6430930d..443459f0 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 762e5582..df2f055b 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 7f2d645b..5c678d36 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 a38062e2..9b83892c 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 4038bc90..550b1fc1 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 78179c16..29655b8a 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 b14cbed9..56c6fc4f 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 cb43cb92..c46d0aaa 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 87773439..caa995a4 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 b643bd6e..c77c1914 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 68efa641..d1c6d2a7 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 cbfbf5ac..ad6875ac 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 78af4815..a02a3e45 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 65fd0ac4..bad2d36e 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 98f01286..efe3ab16 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 f389b814..d729f854 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 5b7d6f8e..d8b8ea62 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 b6f0adc3..3d0893bd 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 ea04a03a..144e1c0a 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 dd843372..fad1b9e4 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 a1d62f91..0d638d9a 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 563ebebc..c8ff0d5a 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 886ca2da..97187727 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 ced7064a..a6c59c90 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 4bc0f35f..8f3ad7da 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 f3d69af4..5d85a14e 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 32070974..9994afa8 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 9fa944d4..758bd82a 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 d5bda1b3..59430475 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 9c9d7205..03d048ef 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 577071e7..ff822a36 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 51de2f9a..43d7a71c 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 ce18f342..d14e7b23 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 00000000..13f193f4
--- /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 ab3acbec..28554059 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 2a111730..0d3bcb53 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 1336c07b..a9735c59 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 bcd88f35..f9b8f9e7 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 d551bb86..a5350a8e 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 0cd4d86a..04aeca91 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 56449381..68f26fa2 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 f26ab9cf..da2361ce 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 f0be3132..d7015c2e 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 9620e3a8..4058f842 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 91fd8482..caf58b4d 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 6ff5cd10..31863b96 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 753bb483..3d055550 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 eea54718..e6335b7b 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 50d1f2a1..da3c7de5 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 c8dadb29..475c24d2 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 3930fc42..f1b02262 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 .