diff options
author | Felix Lange <fjl@twurst.com> | 2015-04-17 08:01:38 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-04-17 20:45:10 +0800 |
commit | 4d5a518a0ba7b0f1d42c73f3c28fe0828e7ea974 (patch) | |
tree | 84d51fd1fef7c977eb1e9466126947c8e36f7164 /rlp/decode.go | |
parent | 574d5d6ae6076c534d314c600ee0e6c0c161cc36 (diff) | |
download | dexon-4d5a518a0ba7b0f1d42c73f3c28fe0828e7ea974.tar.gz dexon-4d5a518a0ba7b0f1d42c73f3c28fe0828e7ea974.tar.zst dexon-4d5a518a0ba7b0f1d42c73f3c28fe0828e7ea974.zip |
rlp: stop accepting lists for byte slices and byte arrays
Diffstat (limited to 'rlp/decode.go')
-rw-r--r-- | rlp/decode.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/rlp/decode.go b/rlp/decode.go index 394f83fb2..97eacf64b 100644 --- a/rlp/decode.go +++ b/rlp/decode.go @@ -58,9 +58,8 @@ type Decoder interface { // } // // To decode into a slice, the input must be a list and the resulting -// slice will contain the input elements in order. -// As a special case, if the slice has a byte-size element type, the input -// can also be an RLP string. +// slice will contain the input elements in order. For byte slices, +// the input must be an RLP string. // // To decode into a Go string, the input must be an RLP string. The // input bytes are taken as-is and will not necessarily be valid UTF-8. @@ -309,13 +308,6 @@ func decodeListArray(s *Stream, val reflect.Value, elemdec decoder) error { } func decodeByteSlice(s *Stream, val reflect.Value) error { - kind, _, err := s.Kind() - if err != nil { - return err - } - if kind == List { - return decodeListSlice(s, val, decodeUint) - } b, err := s.Bytes() if err != nil { return wrapStreamError(err, val.Type()) @@ -351,7 +343,7 @@ func decodeByteArray(s *Stream, val reflect.Value) error { return wrapStreamError(ErrCanonSize, val.Type()) } case List: - return decodeListArray(s, val, decodeUint) + return wrapStreamError(ErrExpectedString, val.Type()) } return nil } |