summaryrefslogtreecommitdiff
path: root/vendor/github.com/json-iterator/go/iter.go
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2019-10-30 14:08:49 +0000
committerValentin Rothberg <rothberg@redhat.com>2019-10-30 15:17:10 +0100
commitd55734e69bcb645802b33ef703d336b89bbeefe1 (patch)
treecb7bd9eb71d4e049473398aff5554404ee16e5d8 /vendor/github.com/json-iterator/go/iter.go
parente7540d0406c49b22de245246d16ebc6e1778df37 (diff)
downloadpodman-d55734e69bcb645802b33ef703d336b89bbeefe1.tar.gz
podman-d55734e69bcb645802b33ef703d336b89bbeefe1.tar.bz2
podman-d55734e69bcb645802b33ef703d336b89bbeefe1.zip
Bump github.com/json-iterator/go from 1.1.7 to 1.1.8
Bumps [github.com/json-iterator/go](https://github.com/json-iterator/go) from 1.1.7 to 1.1.8. - [Release notes](https://github.com/json-iterator/go/releases) - [Commits](https://github.com/json-iterator/go/compare/v1.1.7...1.1.8) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/json-iterator/go/iter.go')
-rw-r--r--vendor/github.com/json-iterator/go/iter.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/github.com/json-iterator/go/iter.go b/vendor/github.com/json-iterator/go/iter.go
index 95ae54fbf..29b31cf78 100644
--- a/vendor/github.com/json-iterator/go/iter.go
+++ b/vendor/github.com/json-iterator/go/iter.go
@@ -74,6 +74,7 @@ type Iterator struct {
buf []byte
head int
tail int
+ depth int
captureStartedAt int
captured []byte
Error error
@@ -88,6 +89,7 @@ func NewIterator(cfg API) *Iterator {
buf: nil,
head: 0,
tail: 0,
+ depth: 0,
}
}
@@ -99,6 +101,7 @@ func Parse(cfg API, reader io.Reader, bufSize int) *Iterator {
buf: make([]byte, bufSize),
head: 0,
tail: 0,
+ depth: 0,
}
}
@@ -110,6 +113,7 @@ func ParseBytes(cfg API, input []byte) *Iterator {
buf: input,
head: 0,
tail: len(input),
+ depth: 0,
}
}
@@ -128,6 +132,7 @@ func (iter *Iterator) Reset(reader io.Reader) *Iterator {
iter.reader = reader
iter.head = 0
iter.tail = 0
+ iter.depth = 0
return iter
}
@@ -137,6 +142,7 @@ func (iter *Iterator) ResetBytes(input []byte) *Iterator {
iter.buf = input
iter.head = 0
iter.tail = len(input)
+ iter.depth = 0
return iter
}
@@ -320,3 +326,24 @@ func (iter *Iterator) Read() interface{} {
return nil
}
}
+
+// 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 <= maxDepth {
+ return true
+ }
+ iter.ReportError("incrementDepth", "exceeded max depth")
+ return false
+}
+
+func (iter *Iterator) decrementDepth() (success bool) {
+ iter.depth--
+ if iter.depth >= 0 {
+ return true
+ }
+ iter.ReportError("decrementDepth", "unexpected negative nesting")
+ return false
+}