summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/asn1-ber.v1
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-05-17 16:51:25 -0400
committerGitHub <noreply@github.com>2017-05-17 16:51:25 -0400
commitd103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26 (patch)
treedbde13123c6add150448f7b75753ac022d862475 /vendor/gopkg.in/asn1-ber.v1
parentcd23b8139a9463b67e3096744321f6f4eb0ca40a (diff)
downloadchat-d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26.tar.gz
chat-d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26.tar.bz2
chat-d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26.zip
Upgrading server dependancies (#6431)
Diffstat (limited to 'vendor/gopkg.in/asn1-ber.v1')
-rw-r--r--vendor/gopkg.in/asn1-ber.v1/.travis.yml3
-rw-r--r--vendor/gopkg.in/asn1-ber.v1/LICENSE43
-rw-r--r--vendor/gopkg.in/asn1-ber.v1/length.go14
-rw-r--r--vendor/gopkg.in/asn1-ber.v1/length_test.go45
4 files changed, 73 insertions, 32 deletions
diff --git a/vendor/gopkg.in/asn1-ber.v1/.travis.yml b/vendor/gopkg.in/asn1-ber.v1/.travis.yml
index 44aa48b87..53063d075 100644
--- a/vendor/gopkg.in/asn1-ber.v1/.travis.yml
+++ b/vendor/gopkg.in/asn1-ber.v1/.travis.yml
@@ -4,6 +4,9 @@ go:
- 1.3
- 1.4
- 1.5
+ - 1.6
+ - 1.7
+ - 1.8
- tip
go_import_path: gopkg.in/asn-ber.v1
install:
diff --git a/vendor/gopkg.in/asn1-ber.v1/LICENSE b/vendor/gopkg.in/asn1-ber.v1/LICENSE
index 744875676..23f942534 100644
--- a/vendor/gopkg.in/asn1-ber.v1/LICENSE
+++ b/vendor/gopkg.in/asn1-ber.v1/LICENSE
@@ -1,27 +1,22 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
+The MIT License (MIT)
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
+Copyright (c) 2011-2015 Michael Mitton (mmitton@gmail.com)
+Portions copyright (c) 2015-2016 go-asn1-ber Authors
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/gopkg.in/asn1-ber.v1/length.go b/vendor/gopkg.in/asn1-ber.v1/length.go
index 8e2ae4ddd..750e8f443 100644
--- a/vendor/gopkg.in/asn1-ber.v1/length.go
+++ b/vendor/gopkg.in/asn1-ber.v1/length.go
@@ -38,6 +38,9 @@ func readLength(reader io.Reader) (length int, read int, err error) {
if lengthBytes > 8 {
return 0, read, errors.New("long-form length overflow")
}
+
+ // Accumulate into a 64-bit variable
+ var length64 int64
for i := 0; i < lengthBytes; i++ {
b, err = readByte(reader)
if err != nil {
@@ -49,8 +52,15 @@ func readLength(reader io.Reader) (length int, read int, err error) {
read++
// x.600, 8.1.3.5
- length <<= 8
- length |= int(b)
+ length64 <<= 8
+ length64 |= int64(b)
+ }
+
+ // Cast to a platform-specific integer
+ length = int(length64)
+ // Ensure we didn't overflow
+ if int64(length) != length64 {
+ return 0, read, errors.New("long-form length overflow")
}
default:
diff --git a/vendor/gopkg.in/asn1-ber.v1/length_test.go b/vendor/gopkg.in/asn1-ber.v1/length_test.go
index afe0e8037..289510a8d 100644
--- a/vendor/gopkg.in/asn1-ber.v1/length_test.go
+++ b/vendor/gopkg.in/asn1-ber.v1/length_test.go
@@ -11,7 +11,7 @@ func TestReadLength(t *testing.T) {
testcases := map[string]struct {
Data []byte
- ExpectedLength int
+ ExpectedLength int64
ExpectedBytesRead int
ExpectedError string
}{
@@ -68,7 +68,19 @@ func TestReadLength(t *testing.T) {
ExpectedLength: 127,
ExpectedBytesRead: 2,
},
- "long-definite-form max length": {
+ "long-definite-form max length (32-bit)": {
+ Data: []byte{
+ LengthLongFormBitmask | 4,
+ 0x7F,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ },
+ ExpectedLength: math.MaxInt32,
+ ExpectedBytesRead: 5,
+ },
+ "long-definite-form max length (64-bit)": {
Data: []byte{
LengthLongFormBitmask | 8,
0x7F,
@@ -86,6 +98,11 @@ func TestReadLength(t *testing.T) {
}
for k, tc := range testcases {
+ // Skip tests requiring 64-bit integers on platforms that don't support them
+ if tc.ExpectedLength != int64(int(tc.ExpectedLength)) {
+ continue
+ }
+
reader := bytes.NewBuffer(tc.Data)
length, read, err := readLength(reader)
@@ -104,7 +121,7 @@ func TestReadLength(t *testing.T) {
t.Errorf("%s: expected read %d, got %d", k, tc.ExpectedBytesRead, read)
}
- if length != tc.ExpectedLength {
+ if int64(length) != tc.ExpectedLength {
t.Errorf("%s: expected length %d, got %d", k, tc.ExpectedLength, length)
}
}
@@ -112,7 +129,7 @@ func TestReadLength(t *testing.T) {
func TestEncodeLength(t *testing.T) {
testcases := map[string]struct {
- Length int
+ Length int64
ExpectedBytes []byte
}{
"0": {
@@ -133,7 +150,18 @@ func TestEncodeLength(t *testing.T) {
ExpectedBytes: []byte{LengthLongFormBitmask | 1, 128},
},
- "max long-form length": {
+ "max long-form length (32-bit)": {
+ Length: math.MaxInt32,
+ ExpectedBytes: []byte{
+ LengthLongFormBitmask | 4,
+ 0x7F,
+ 0xFF,
+ 0xFF,
+ 0xFF,
+ },
+ },
+
+ "max long-form length (64-bit)": {
Length: math.MaxInt64,
ExpectedBytes: []byte{
LengthLongFormBitmask | 8,
@@ -150,7 +178,12 @@ func TestEncodeLength(t *testing.T) {
}
for k, tc := range testcases {
- b := encodeLength(tc.Length)
+ // Skip tests requiring 64-bit integers on platforms that don't support them
+ if tc.Length != int64(int(tc.Length)) {
+ continue
+ }
+
+ b := encodeLength(int(tc.Length))
if bytes.Compare(tc.ExpectedBytes, b) != 0 {
t.Errorf("%s: Expected\n\t%#v\ngot\n\t%#v", k, tc.ExpectedBytes, b)
}