]>
Commit | Line | Data |
---|---|---|
df3af446 S |
1 | #include <gtest/gtest.h> |
2 | ||
3 | #include "json/json_spirit_reader_template.h" | |
4 | ||
5 | using namespace json_spirit; | |
6 | ||
7 | // This test checks if we have fixed a stack overflow problem with json_spirit. | |
8 | // It was possible to try and create an unlimited number of nested compound elements. | |
9 | // Without the fix in json_spirit_reader_template.h, this test will segfault. | |
10 | TEST(json_spirit_tests, nested_input_segfault) { | |
11 | std::vector<char> v (100000); | |
12 | std::fill (v.begin(),v.end(), '['); | |
13 | std::string s(v.begin(), v.end()); | |
14 | Value value; | |
15 | bool b = json_spirit::read_string(s, value); | |
16 | ASSERT_FALSE(b); | |
17 | } |