Fix decoding of []byte type

This commit is contained in:
Masaaki Goshima 2020-12-24 19:36:49 +09:00
parent 048ba8296d
commit 8628848924
2 changed files with 5 additions and 2 deletions

View File

@ -65,10 +65,11 @@ func (d *bytesDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (int64
cursor = c
decodedLen := base64.StdEncoding.DecodedLen(len(bytes))
b := make([]byte, decodedLen)
if _, err := base64.StdEncoding.Decode(b, bytes); err != nil {
n, err := base64.StdEncoding.Decode(b, bytes)
if err != nil {
return 0, err
}
*(*[]byte)(p) = b
*(*[]byte)(p) = b[:n]
return cursor, nil
}

View File

@ -1864,6 +1864,7 @@ func TestUnmarshalMarshal(t *testing.T) {
return
}
}
*/
var numberTests = []struct {
in string
@ -1916,6 +1917,7 @@ func TestLargeByteSlice(t *testing.T) {
}
}
/*
type Xint struct {
X int
}