Commit d9f8bf2
committed
Return false in Reader::readValue when stack limit is exceeded
jsoncpp, as a shared library, should not call `abort` merely because there's an error reading a value.
See https://en.cppreference.com/w/c/program/abort, `abort` should only be called to **abnormally** cause the program to exit. Functions inserted by `atexit` are also not called, meaning that the host program may have not cleaned up resources properly. But here, exceeding stack limit isn't a sign of abnormalty.
`exit` is not a good substitute either, see the `exit-in-shared-library` from Debian:
https://lintian.debian.org/tags/exit-in-shared-library.html
Fix #1618
In this case, returning false seems like a better idea.1 parent ca98c98 commit d9f8bf2
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
146 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
147 | 152 | | |
148 | 153 | | |
149 | 154 | | |
| |||
0 commit comments