1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

Revert "Merge pull request #418 from bbrks/configurable_maxDepth"

This reverts commit 44a7e7340d, reversing
changes made to dc11f49689.
This commit is contained in:
Jordan Liggitt
2019-12-19 19:06:29 -05:00
parent 44a7e7340d
commit 7c9f8c2d20
3 changed files with 5 additions and 52 deletions

View File

@ -327,9 +327,12 @@ func (iter *Iterator) Read() interface{} {
}
}
// limit maximum depth of nesting, as allowed by https://tools.ietf.org/html/rfc7159#section-9
const maxDepth = 10000
func (iter *Iterator) incrementDepth() (success bool) {
iter.depth++
if iter.depth <= iter.cfg.maxDepth || iter.cfg.maxDepth < 0 {
if iter.depth <= maxDepth {
return true
}
iter.ReportError("incrementDepth", "exceeded max depth")