Skip to content

Commit

Permalink
Merge pull request #258 from preethamrn/fix-bytes-decodestream
Browse files Browse the repository at this point in the history
Fix decoding of []byte type
  • Loading branch information
goccy committed Jun 25, 2021
2 parents 397a4e4 + 2aeb176 commit 923c0f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/decoder/bytes.go
Expand Up @@ -49,10 +49,11 @@ func (d *bytesDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) er
}
decodedLen := base64.StdEncoding.DecodedLen(len(bytes))
buf := make([]byte, decodedLen)
if _, err := base64.StdEncoding.Decode(buf, bytes); err != nil {
n, err := base64.StdEncoding.Decode(buf, bytes)
if err != nil {
return err
}
*(*[]byte)(p) = buf
*(*[]byte)(p) = buf[:n]
s.reset()
return nil
}
Expand Down

0 comments on commit 923c0f7

Please sign in to comment.