mirror of https://github.com/jackc/pgx.git
Fix: pgtype.Bits makes copy of data from read buffer
It was taking a reference. This would cause the data to be corrupted by future reads. fixes #1909pull/1919/head
parent
5c63f646f8
commit
654dcab93e
|
@ -176,8 +176,10 @@ func (scanPlanBinaryBitsToBitsScanner) Scan(src []byte, dst any) error {
|
||||||
|
|
||||||
bitLen := int32(binary.BigEndian.Uint32(src))
|
bitLen := int32(binary.BigEndian.Uint32(src))
|
||||||
rp := 4
|
rp := 4
|
||||||
|
buf := make([]byte, len(src[rp:]))
|
||||||
|
copy(buf, src[rp:])
|
||||||
|
|
||||||
return scanner.ScanBits(Bits{Bytes: src[rp:], Len: bitLen, Valid: true})
|
return scanner.ScanBits(Bits{Bytes: buf, Len: bitLen, Valid: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
type scanPlanTextAnyToBitsScanner struct{}
|
type scanPlanTextAnyToBitsScanner struct{}
|
||||||
|
|
Loading…
Reference in New Issue