Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions encoding/prototext/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,9 @@ func (d decoder) unmarshalExpandedAny(typeURL string, pos int) ([]byte, error) {
// to the next field. It relies on Read returning an error if the types are not
// in valid sequence.
func (d decoder) skipValue() error {
if d.opts.RecursionLimit--; d.opts.RecursionLimit < 0 {
return errRecursionDepth
}
tok, err := d.Read()
if err != nil {
return err
Expand Down Expand Up @@ -768,6 +771,9 @@ func (d decoder) skipValue() error {
// skipMessageValue makes the decoder parse and skip over all fields in a
// message. It assumes that the previous read type is MessageOpen.
func (d decoder) skipMessageValue() error {
if d.opts.RecursionLimit--; d.opts.RecursionLimit < 0 {
return errRecursionDepth
}
for {
tok, err := d.Read()
if err != nil {
Expand Down