diff options
author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-04-23 09:31:19 +0700 |
---|---|---|
committer | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-04-23 05:38:47 +0000 |
commit | 5963f0a332496a68f1eb2d0c6a5badd73c9f046d (patch) | |
tree | 9bc17672d8fe9e50f0c73d725120dfd394a8a09b /src/vendor | |
parent | d310b2a6b8a66eeb5953b1e682cf27669c8a08c2 (diff) | |
download | go-5963f0a332496a68f1eb2d0c6a5badd73c9f046d.tar.gz go-5963f0a332496a68f1eb2d0c6a5badd73c9f046d.zip |
cmd/vendor: get golang.org/x/tools@f946a157eef
To bring in the fix for sigchanyzer pass to detect valid usage of
unbuffer channel to builtin make.
Fixes #45043
Change-Id: I60d2ee90f7c111183b33747008903a7df88b76ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/312631
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/vendor')
-rw-r--r-- | src/vendor/golang.org/x/net/dns/dnsmessage/message.go | 83 | ||||
-rw-r--r-- | src/vendor/modules.txt | 4 |
2 files changed, 82 insertions, 5 deletions
diff --git a/src/vendor/golang.org/x/net/dns/dnsmessage/message.go b/src/vendor/golang.org/x/net/dns/dnsmessage/message.go index 654f191f8a..1736fc5d12 100644 --- a/src/vendor/golang.org/x/net/dns/dnsmessage/message.go +++ b/src/vendor/golang.org/x/net/dns/dnsmessage/message.go @@ -1023,6 +1023,24 @@ func (p *Parser) OPTResource() (OPTResource, error) { return r, nil } +// UnknownResource parses a single UnknownResource. +// +// One of the XXXHeader methods must have been called before calling this +// method. +func (p *Parser) UnknownResource() (UnknownResource, error) { + if !p.resHeaderValid { + return UnknownResource{}, ErrNotStarted + } + r, err := unpackUnknownResource(p.resHeader.Type, p.msg, p.off, p.resHeader.Length) + if err != nil { + return UnknownResource{}, err + } + p.off += int(p.resHeader.Length) + p.resHeaderValid = false + p.index++ + return r, nil +} + // Unpack parses a full Message. func (m *Message) Unpack(msg []byte) error { var p Parser @@ -1557,6 +1575,30 @@ func (b *Builder) OPTResource(h ResourceHeader, r OPTResource) error { return nil } +// UnknownResource adds a single UnknownResource. +func (b *Builder) UnknownResource(h ResourceHeader, r UnknownResource) error { + if err := b.checkResourceSection(); err != nil { + return err + } + h.Type = r.realType() + msg, lenOff, err := h.pack(b.msg, b.compression, b.start) + if err != nil { + return &nestedError{"ResourceHeader", err} + } + preLen := len(msg) + if msg, err = r.pack(msg, b.compression, b.start); err != nil { + return &nestedError{"UnknownResource body", err} + } + if err := h.fixLen(msg, lenOff, preLen); err != nil { + return err + } + if err := b.incrementSectionCount(); err != nil { + return err + } + b.msg = msg + return nil +} + // Finish ends message building and generates a binary message. func (b *Builder) Finish() ([]byte, error) { if b.section < sectionHeader { @@ -2135,13 +2177,15 @@ func unpackResourceBody(msg []byte, off int, hdr ResourceHeader) (ResourceBody, rb, err = unpackOPTResource(msg, off, hdr.Length) r = &rb name = "OPT" + default: + var rb UnknownResource + rb, err = unpackUnknownResource(hdr.Type, msg, off, hdr.Length) + r = &rb + name = "Unknown" } if err != nil { return nil, off, &nestedError{name + " record", err} } - if r == nil { - return nil, off, errors.New("invalid resource type: " + hdr.Type.String()) - } return r, off + int(hdr.Length), nil } @@ -2585,3 +2629,36 @@ func unpackOPTResource(msg []byte, off int, length uint16) (OPTResource, error) } return OPTResource{opts}, nil } + +// An UnknownResource is a catch-all container for unknown record types. +type UnknownResource struct { + Type Type + Data []byte +} + +func (r *UnknownResource) realType() Type { + return r.Type +} + +// pack appends the wire format of the UnknownResource to msg. +func (r *UnknownResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { + return packBytes(msg, r.Data[:]), nil +} + +// GoString implements fmt.GoStringer.GoString. +func (r *UnknownResource) GoString() string { + return "dnsmessage.UnknownResource{" + + "Type: " + r.Type.GoString() + ", " + + "Data: []byte{" + printByteSlice(r.Data) + "}}" +} + +func unpackUnknownResource(recordType Type, msg []byte, off int, length uint16) (UnknownResource, error) { + parsed := UnknownResource{ + Type: recordType, + Data: make([]byte, length), + } + if _, err := unpackBytes(msg, off, parsed.Data); err != nil { + return UnknownResource{}, err + } + return parsed, nil +} diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt index 15a3aef4f8..499e6fc3fa 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -8,7 +8,7 @@ golang.org/x/crypto/curve25519 golang.org/x/crypto/hkdf golang.org/x/crypto/internal/subtle golang.org/x/crypto/poly1305 -# golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 +# golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 ## explicit golang.org/x/net/dns/dnsmessage golang.org/x/net/http/httpguts @@ -18,7 +18,7 @@ golang.org/x/net/idna golang.org/x/net/lif golang.org/x/net/nettest golang.org/x/net/route -# golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 +# golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 ## explicit golang.org/x/sys/cpu # golang.org/x/text v0.3.6-0.20210227105805-e3aa4adf54f6 |