mirror of https://github.com/goccy/go-json.git
Fix decoding of []byte type
This commit is contained in:
parent
048ba8296d
commit
8628848924
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue