diff --git a/protocol/thrift/binary.go b/protocol/thrift/binary.go index fc32b5e..7c276fb 100644 --- a/protocol/thrift/binary.go +++ b/protocol/thrift/binary.go @@ -378,9 +378,7 @@ func (BinaryProtocol) ReadDouble(buf []byte) (v float64, l int, err error) { return math.Float64frombits(binary.BigEndian.Uint64(buf)), 8, nil } -var ( - errDepthLimitExceeded = NewProtocolException(DEPTH_LIMIT, "depth limit exceeded") -) +var errDepthLimitExceeded = NewProtocolException(DEPTH_LIMIT, "depth limit exceeded") var typeToSize = [256]int8{ BOOL: 1, diff --git a/protocol/thrift/binaryreader.go b/protocol/thrift/binaryreader.go index 8d2b104..b0a77e0 100644 --- a/protocol/thrift/binaryreader.go +++ b/protocol/thrift/binaryreader.go @@ -354,6 +354,9 @@ func (r *BinaryReader) skipType(t TType, maxdepth int) error { case STRUCT: for { ft, _, err := r.ReadFieldBegin() + if err != nil { + return err + } if ft == STOP { return nil } diff --git a/protocol/thrift/binaryreader_test.go b/protocol/thrift/binaryreader_test.go index abca126..accd165 100644 --- a/protocol/thrift/binaryreader_test.go +++ b/protocol/thrift/binaryreader_test.go @@ -257,5 +257,4 @@ func TestBinaryReaderSkip(t *testing.T) { err = r.Skip(TType(122)) require.Error(t, err) } - }