mirror of https://github.com/jackc/pgx.git
add byte length check to uint32
parent
b197994b1f
commit
73bbced270
|
@ -296,6 +296,10 @@ func (scanPlanBinaryUint32ToTextScanner) Scan(src []byte, dst any) error {
|
|||
return s.ScanText(Text{})
|
||||
}
|
||||
|
||||
if len(src) != 4 {
|
||||
return fmt.Errorf("invalid length for uint32: %v", len(src))
|
||||
}
|
||||
|
||||
n := uint64(binary.BigEndian.Uint32(src))
|
||||
return s.ScanText(Text{String: strconv.FormatUint(n, 10), Valid: true})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue