Skip to content

Commit 77632b2

Browse files
authored
Merge pull request open-source-parsers#549 from jia3ep/master
Added stack overflow test
2 parents 34fc002 + 89aa87b commit 77632b2

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030

3131
# CMake-generated files:
3232
CMakeFiles/
33-
CTestTestFile.cmake
34-
cmake_install.cmake
33+
*.cmake
3534
pkg-config/jsoncpp.pc
3635
jsoncpp_lib_static.dir/
3736

@@ -45,6 +44,7 @@ jsoncpp_lib_static.dir/
4544
/src/lib_json/Makefile
4645
/src/test_lib_json/Makefile
4746
/src/test_lib_json/jsoncpp_test
47+
*.a
4848

4949
# eclipse project files
5050
.project

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
install:
1010
# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
1111
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
12-
# /usr/bin/clang is our version already, and clang-X.Y does not exist.
13-
#- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
12+
# /usr/bin/clang has a conflict with gcc, so use clang-X.Y.
13+
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.5" CC="clang-3.5"; fi
1414
- echo ${PATH}
1515
- ls /usr/local
1616
- ls /usr/local/bin
@@ -22,10 +22,11 @@ addons:
2222
apt:
2323
sources:
2424
- ubuntu-toolchain-r-test
25+
- llvm-toolchain-precise-3.5
2526
packages:
2627
- gcc-4.9
2728
- g++-4.9
28-
- clang
29+
- clang-3.5
2930
- valgrind
3031
os:
3132
- linux

src/lib_json/json_reader.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@
4545
#endif
4646

4747
static int const stackLimit_g = 1000;
48+
#if __cplusplus >= 201103L
49+
thread_local static int stackDepth_g = 0; // see readValue()
50+
#else
4851
static int stackDepth_g = 0; // see readValue()
52+
#endif
4953

5054
namespace Json {
5155

test/data/fail_test_stack_limit.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[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