Source File
dec_depth.go
Belonging Package
github.com/go-faster/jx
package jx
import
// limit maximum depth of nesting, as allowed by https://tools.ietf.org/html/rfc7159#section-9
const maxDepth = 10000
var errMaxDepth = errors.New("depth: maximum")
func ( *Decoder) () error {
.depth++
if .depth > maxDepth {
return errMaxDepth
}
return nil
}
var errNegativeDepth = errors.New("depth: negative")
func ( *Decoder) () error {
.depth--
if .depth < 0 {
return errNegativeDepth
}
return nil
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |