forked from mirror/go-json
Fix checkptr validation error on decode
This commit is contained in:
parent
eee16e83f5
commit
e4214835d8
|
@ -32,7 +32,7 @@ func (d *arrayDecoder) decodeStream(s *stream, p unsafe.Pointer) error {
|
|||
for {
|
||||
s.cursor++
|
||||
addr := uintptr(p) + uintptr(idx)*d.size
|
||||
if err := d.valueDecoder.decodeStream(s, unsafe.Pointer(addr)); err != nil {
|
||||
if err := d.valueDecoder.decodeStream(s, *(*unsafe.Pointer)(unsafe.Pointer(&addr))); err != nil {
|
||||
return err
|
||||
}
|
||||
s.skipWhiteSpace()
|
||||
|
@ -92,7 +92,7 @@ func (d *arrayDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (int64
|
|||
for {
|
||||
cursor++
|
||||
addr := uintptr(p) + uintptr(idx)*d.size
|
||||
c, err := d.valueDecoder.decode(buf, cursor, unsafe.Pointer(addr))
|
||||
c, err := d.valueDecoder.decode(buf, cursor, *(*unsafe.Pointer)(unsafe.Pointer(&addr)))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ func (d *sliceDecoder) decodeStream(s *stream, p unsafe.Pointer) error {
|
|||
copySlice(d.elemType, dst, src)
|
||||
}
|
||||
addr := uintptr(data) + uintptr(idx)*d.size
|
||||
if err := d.valueDecoder.decodeStream(s, unsafe.Pointer(addr)); err != nil {
|
||||
if err := d.valueDecoder.decodeStream(s, *(*unsafe.Pointer)(unsafe.Pointer(&addr))); err != nil {
|
||||
return err
|
||||
}
|
||||
s.skipWhiteSpace()
|
||||
|
@ -192,7 +192,7 @@ func (d *sliceDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (int64
|
|||
copySlice(d.elemType, dst, src)
|
||||
}
|
||||
addr := uintptr(data) + uintptr(idx)*d.size
|
||||
c, err := d.valueDecoder.decode(buf, cursor, unsafe.Pointer(addr))
|
||||
c, err := d.valueDecoder.decode(buf, cursor, *(*unsafe.Pointer)(unsafe.Pointer(&addr)))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ func (d *structDecoder) decodeStream(s *stream, p unsafe.Pointer) error {
|
|||
field, exists := d.fieldMap[k]
|
||||
if exists {
|
||||
addr := uintptr(p) + field.offset
|
||||
if err := field.dec.decodeStream(s, unsafe.Pointer(addr)); err != nil {
|
||||
if err := field.dec.decodeStream(s, *(*unsafe.Pointer)(unsafe.Pointer(&addr))); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if s.disallowUnknownFields {
|
||||
|
@ -110,7 +110,7 @@ func (d *structDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (int6
|
|||
field, exists := d.fieldMap[k]
|
||||
if exists {
|
||||
addr := uintptr(p) + field.offset
|
||||
c, err := field.dec.decode(buf, cursor, unsafe.Pointer(addr))
|
||||
c, err := field.dec.decode(buf, cursor, *(*unsafe.Pointer)(unsafe.Pointer(&addr)))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue